bel 0.3.3 → 0.4.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +53 -8
  3. data/bel.gemspec +10 -15
  4. data/bin/bel +63 -4
  5. data/bin/bel2rdf.rb +1 -1
  6. data/bin/bel_compare.rb +1 -1
  7. data/bin/bel_parse.rb +1 -1
  8. data/bin/bel_rdfschema.rb +1 -1
  9. data/bin/bel_summarize.rb +1 -1
  10. data/bin/bel_upgrade.rb +1 -1
  11. data/lib/bel.rb +8 -10
  12. data/lib/bel/completion.rb +3 -2
  13. data/lib/bel/completion/value_match_rule.rb +10 -0
  14. data/lib/bel/evidence_model/citation.rb +101 -43
  15. data/lib/bel/evidence_model/evidence.rb +2 -2
  16. data/lib/bel/evidence_model/experiment_context.rb +1 -0
  17. data/lib/bel/evidence_model/metadata.rb +15 -2
  18. data/lib/bel/evidence_model/references.rb +10 -10
  19. data/lib/bel/json.rb +63 -0
  20. data/lib/bel/json/adapter/multi_json.rb +36 -0
  21. data/lib/bel/json/adapter/oj.rb +65 -0
  22. data/lib/bel/json/adapter/ruby_json.rb +28 -0
  23. data/lib/bel/json/reader.rb +9 -0
  24. data/lib/bel/json/writer.rb +9 -0
  25. data/lib/bel/libbel.rb +1 -4
  26. data/lib/bel/parser.rb +2 -2
  27. data/lib/bel/rdf_repository.rb +18 -0
  28. data/lib/bel/rdf_repository/plugins/memory.rb +28 -0
  29. data/lib/bel/rdf_repository/plugins/mongo.rb +28 -0
  30. data/lib/bel/resource.rb +24 -0
  31. data/lib/bel/resource/namespace.rb +122 -0
  32. data/lib/bel/resource/namespace_value.rb +69 -0
  33. data/lib/bel/resource/namespaces.rb +83 -0
  34. data/lib/bel/resource/search.rb +26 -0
  35. data/lib/bel/resource/search/api.rb +36 -0
  36. data/lib/bel/resource/search/search_result.rb +32 -0
  37. data/lib/bel/translate.rb +108 -0
  38. data/lib/bel/translator.rb +69 -0
  39. data/lib/bel/translator/plugins/bel_script.rb +36 -0
  40. data/lib/bel/translator/plugins/bel_script/bel_yielder.rb +144 -0
  41. data/lib/bel/translator/plugins/bel_script/evidence_yielder.rb +95 -0
  42. data/lib/bel/translator/plugins/bel_script/translator.rb +24 -0
  43. data/lib/bel/translator/plugins/jgf.rb +37 -0
  44. data/lib/bel/translator/plugins/jgf/translator.rb +160 -0
  45. data/lib/bel/translator/plugins/json_evidence.rb +38 -0
  46. data/lib/bel/translator/plugins/json_evidence/translator.rb +90 -0
  47. data/lib/bel/translator/plugins/rdf.rb +48 -0
  48. data/lib/bel/translator/plugins/rdf/bel_schema.rb +339 -0
  49. data/lib/bel/translator/plugins/rdf/monkey_patch.rb +310 -0
  50. data/lib/bel/translator/plugins/rdf/reader.rb +173 -0
  51. data/lib/bel/translator/plugins/rdf/translator.rb +40 -0
  52. data/lib/bel/translator/plugins/rdf/writer.rb +45 -0
  53. data/lib/bel/translator/plugins/xbel.rb +36 -0
  54. data/lib/bel/translator/plugins/xbel/evidence_handler.rb +468 -0
  55. data/lib/bel/translator/plugins/xbel/evidence_yielder.rb +24 -0
  56. data/lib/bel/translator/plugins/xbel/translator.rb +24 -0
  57. data/lib/bel/translator/plugins/xbel/xbel_yielder.rb +414 -0
  58. data/lib/bel/vendor/little-plugger.rb +323 -0
  59. data/lib/bel/version.rb +1 -1
  60. metadata +44 -158
  61. data/lib/bel/extension.rb +0 -37
  62. data/lib/bel/extension_format.rb +0 -207
  63. data/lib/bel/extensions/bel.rb +0 -258
  64. data/lib/bel/extensions/jgf.rb +0 -219
  65. data/lib/bel/extensions/json/jrjackson.rb +0 -31
  66. data/lib/bel/extensions/json/json.rb +0 -133
  67. data/lib/bel/extensions/json/multi_json.rb +0 -29
  68. data/lib/bel/extensions/json/oj.rb +0 -68
  69. data/lib/bel/extensions/json/ruby_json.rb +0 -29
  70. data/lib/bel/extensions/rdf/bel_rdf.rb +0 -338
  71. data/lib/bel/extensions/rdf/rdf.rb +0 -584
  72. data/lib/bel/extensions/xbel.rb +0 -923
  73. data/lib/bel/format.rb +0 -58
@@ -1,29 +0,0 @@
1
- require 'json'
2
-
3
- module BEL::Extension::Format
4
- module JSONImplementation
5
-
6
- class JSONReader
7
- def initialize(data)
8
- @data = data
9
- end
10
-
11
- def each(&block)
12
- if block_given?
13
- JSON.load(@data, nil, :symbolize_names => true).each do |obj|
14
- yield obj
15
- end
16
- else
17
- to_enum(:each)
18
- end
19
- end
20
- end
21
-
22
- class JSONWriter
23
-
24
- def write_json_object(json_object)
25
- JSON.dump(json_object)
26
- end
27
- end
28
- end
29
- end
@@ -1,338 +0,0 @@
1
- # vim: ts=2 sw=2:
2
- # Defines the RDF vocabulary for BEL structures.
3
-
4
- # rename rdf module to avoid conflict within BEL::RDF
5
- RUBYRDF = RDF
6
-
7
- module BEL
8
- module RDF
9
-
10
- # uri prefixes
11
- BELR = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/')
12
- BELV = RUBYRDF::Vocabulary.new('http://www.openbel.org/vocabulary/')
13
- PUBMED = RUBYRDF::Vocabulary.new('http://bio2rdf.org/pubmed:')
14
- RDF = RUBYRDF
15
- RDFS = RUBYRDF::RDFS
16
-
17
- # annotations
18
- Anatomy = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/anatomy/')
19
- Cell = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/cell/')
20
- CellLine = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/cell-line/')
21
- CellStructure = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/cell-structure/')
22
- Disease = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/disease/')
23
- MeSHAnatomy = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/mesh-anatomy/')
24
- MeSHDisease = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/mesh-diseases/')
25
- Species = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/species-taxonomy-id/')
26
-
27
- # maps outer function to bel/vocabulary class
28
- FUNCTION_TYPE = {
29
- a: BELV.Abundance,
30
- act: BELV.AbundanceActivity,
31
- bp: BELV.BiologicalProcess,
32
- cat: BELV.AbundanceActivity,
33
- chap: BELV.AbundanceActivity,
34
- complex: BELV.ComplexAbundance,
35
- composite: BELV.CompositeAbundance,
36
- deg: BELV.Degradation,
37
- fus: BELV.Fusion,
38
- g: BELV.GeneAbundance,
39
- gtp: BELV.AbundanceActivity,
40
- kin: BELV.AbundanceActivity,
41
- m: BELV.microRNAAbundance,
42
- p: BELV.ProteinAbundance,
43
- path: BELV.Pathology,
44
- pep: BELV.AbundanceActivity,
45
- phos: BELV.AbundanceActivity,
46
- pmod: BELV.ProteinModification,
47
- r: BELV.RNAAbundance,
48
- ribo: BELV.AbundanceActivity,
49
- rxn: BELV.Reaction,
50
- sec: BELV.CellSecretion,
51
- sub: BELV.Substitution,
52
- surf: BELV.CellSurfaceExpression,
53
- tloc: BELV.Translocation,
54
- tport: BELV.AbundanceActivity,
55
- tscript: BELV.AbundanceActivity,
56
- abundance: BELV.Abundance,
57
- biologicalProcess: BELV.BiologicalProcess,
58
- catalyticActivity: BELV.AbundanceActivity,
59
- cellSecretion: BELV.CellSecretion,
60
- cellSurfaceExpression: BELV.CellSurfaceExpression,
61
- chaperoneActivity: BELV.AbundanceActivity,
62
- complexAbundance: BELV.ComplexAbundance,
63
- compositeAbundance: BELV.CompositeAbundance,
64
- degradation: BELV.Degradation,
65
- fusion: BELV.Fusion,
66
- geneAbundance: BELV.GeneAbundance,
67
- gtpBoundActivity: BELV.AbundanceActivity,
68
- kinaseActivity: BELV.AbundanceActivity,
69
- list: BELV.List,
70
- microRNAAbundance: BELV.microRNAAbundance,
71
- molecularActivity: BELV.AbundanceActivity,
72
- pathology: BELV.Pathology,
73
- peptidaseActivity: BELV.AbundanceActivity,
74
- phosphataseActivity: BELV.AbundanceActivity,
75
- products: BELV.Products,
76
- proteinAbundance: BELV.ProteinAbundance,
77
- proteinModification: BELV.ProteinModification,
78
- reactants: BELV.Reactants,
79
- reaction: BELV.Reaction,
80
- ribosylationActivity: BELV.AbundanceActivity,
81
- rnaAbundance: BELV.RNAAbundance,
82
- substitution: BELV.Substitution,
83
- transcriptionalActivity: BELV.AbundanceActivity,
84
- translocation: BELV.Translocation,
85
- transportActivity: BELV.AbundanceActivity,
86
- truncation: BELV.Truncation,
87
- }
88
-
89
- RELATIONSHIP_TYPE = {
90
- '--' => BELV.Association,
91
- '-|' => BELV.Decreases,
92
- '=|' => BELV.DirectlyDecreases,
93
- '=>' => BELV.DirectlyIncreases,
94
- '->' => BELV.Increases,
95
- ':>' => BELV.TranscribedTo,
96
- '>>' => BELV.TranslatedTo,
97
- 'actsIn' => BELV.ActsIn,
98
- 'analogous' => BELV.Analogous,
99
- 'association' => BELV.Association,
100
- 'biomarkerFor' => BELV.BiomarkerFor,
101
- 'causesNoChange' => BELV.CausesNoChange,
102
- 'decreases' => BELV.Decreases,
103
- 'directlyDecreases' => BELV.DirectlyDecreases,
104
- 'directlyIncreases' => BELV.DirectlyIncreases,
105
- 'hasComponent' => BELV.HasComponent,
106
- 'hasComponents' => BELV.HasComponents,
107
- 'hasMember' => BELV.HasMember,
108
- 'hasMembers' => BELV.HasMembers,
109
- 'hasModification' => BELV.HasModification,
110
- 'hasProduct' => BELV.HasProduct,
111
- 'hasVariant' => BELV.HasVariant,
112
- 'includes' => BELV.Includes,
113
- 'increases' => BELV.Increases,
114
- 'isA' => BELV.IsA,
115
- 'negativeCorrelation' => BELV.NegativeCorrelation,
116
- 'orthologous' => BELV.Orthologous,
117
- 'positiveCorrelation' => BELV.PositiveCorrelation,
118
- 'prognosticBiomarkerFor' => BELV.PrognosticBiomarkerFor,
119
- 'rateLimitingStepOf' => BELV.RateLimitingStepOf,
120
- 'reactantIn' => BELV.ReactantIn,
121
- 'subProcessOf' => BELV.SubProcessOf,
122
- 'transcribedTo' => BELV.TranscribedTo,
123
- 'translatedTo' => BELV.TranslatedTo,
124
- 'translocates' => BELV.Translocates,
125
- }
126
-
127
- RELATIONSHIP_CLASSIFICATION = {
128
- :'--' => BELV.CorrelativeRelationship,
129
- :'-|' => BELV.Decreases,
130
- :'=|' => BELV.DirectlyDecreases,
131
- :'=>' => BELV.DirectlyIncreases,
132
- :'->' => BELV.Increases,
133
- :'association' => BELV.CorrelativeRelationship,
134
- :'biomarkerFor' => BELV.BiomarkerFor,
135
- :'causesNoChange' => BELV.CausesNoChange,
136
- :'decreases' => BELV.Decreases,
137
- :'directlyDecreases' => BELV.DirectlyDecreases,
138
- :'directlyIncreases' => BELV.DirectlyIncreases,
139
- :'hasComponent' => BELV.HasComponent,
140
- :'hasMember' => BELV.HasMember,
141
- :'increases' => BELV.Increases,
142
- :'isA' => BELV.IsA,
143
- :'negativeCorrelation' => BELV.NegativeCorrelation,
144
- :'positiveCorrelation' => BELV.PositiveCorrelation,
145
- :'prognosticBiomarkerFor' => BELV.PrognosticBiomarkerFor,
146
- :'rateLimitingStepOf' => BELV.RateLimitingStepOf,
147
- :'subProcessOf' => BELV.SubProcessOf,
148
- }
149
-
150
- ACTIVITY_TYPE = {
151
- act: BELV.Activity,
152
- cat: BELV.Catalytic,
153
- chap: BELV.Chaperone,
154
- gtp: BELV.GtpBound,
155
- kin: BELV.Kinase,
156
- pep: BELV.Peptidase,
157
- phos: BELV.Phosphatase,
158
- ribo: BELV.Ribosylase,
159
- tport: BELV.Transport,
160
- tscript: BELV.Transcription,
161
- catalyticActivity: BELV.Catalytic,
162
- chaperoneActivity: BELV.Chaperone,
163
- gtpBoundActivity: BELV.GtpBound,
164
- kinaseActivity: BELV.Kinase,
165
- molecularActivity: BELV.Activity,
166
- peptidaseActivity: BELV.Peptidase,
167
- phosphataseActivity: BELV.Phosphatase,
168
- ribosylationActivity: BELV.Ribosylase,
169
- transcriptionalActivity: BELV.Transcription,
170
- transportActivity: BELV.Transport,
171
- }
172
-
173
- # maps modification types to bel/vocabulary class
174
- MODIFICATION_TYPE = {
175
- 'A' => BELV.Acetylation,
176
- 'F' => BELV.Farnesylation,
177
- 'G' => BELV.Glycosylation,
178
- 'H' => BELV.Hydroxylation,
179
- 'M' => BELV.Methylation,
180
- 'P' => BELV.Phosphorylation,
181
- 'P,S' => BELV.PhosphorylationSerine,
182
- 'P,T' => BELV.PhosphorylationThreonine,
183
- 'P,Y' => BELV.PhosphorylationTyrosine,
184
- 'R' => BELV.Ribosylation,
185
- 'S' => BELV.Sumoylation,
186
- 'U' => BELV.Ubiquitination,
187
- }
188
-
189
- # protein variant
190
- PROTEIN_VARIANT = [:fus, :fusion, :sub, :substitution, :trunc, :truncation]
191
-
192
- def self.vocabulary_rdf
193
- [
194
- # Classes
195
- # Concept - Annotations
196
- [BELV.AnnotationConcept, RDF::RDFS.subClassOf, RDF::SKOS.Concept],
197
- [BELV.AnnotationConceptScheme, RDF::RDFS.subClassOf, RDF::SKOS.ConceptScheme],
198
- # Concept - Namespaces
199
- [BELV.AbundanceConcept, RDF::RDFS.subClassOf, BELV.NamespaceConcept],
200
- [BELV.BiologicalProcessConcept, RDF::RDFS.subClassOf, BELV.NamespaceConcept],
201
- [BELV.ComplexConcept, RDF::RDFS.subClassOf, BELV.AbundanceConcept],
202
- [BELV.GeneConcept, RDF::RDFS.subClassOf, BELV.AbundanceConcept],
203
- [BELV.MicroRNAConcept, RDF::RDFS.subClassOf, BELV.RNAConcept],
204
- [BELV.NamespaceConceptScheme, RDF::RDFS.subClassOf, RDF::SKOS.ConceptScheme],
205
- [BELV.NamespaceConcept, RDF::RDFS.subClassOf, RDF::SKOS.Concept],
206
- [BELV.ProteinConcept, RDF::RDFS.subClassOf, BELV.AbundanceConcept],
207
- [BELV.RNAConcept, RDF::RDFS.subClassOf, BELV.AbundanceConcept],
208
- [BELV.PathologyConcept, RDF::RDFS.subClassOf, BELV.BiologicalProcessConcept],
209
- # BEL Language
210
- [BELV.Abundance, RDF.type, RDF::RDFS.Class],
211
- [BELV.Activity, RDF.type, RDF::RDFS.Class],
212
- [BELV.Evidence, RDF.type, RDF::RDFS.Class],
213
- [BELV.Modification, RDF.type, RDF::RDFS.Class],
214
- [BELV.Relationship, RDF.type, RDF::RDFS.Class],
215
- [BELV.Statement, RDF.type, RDF::RDFS.Class],
216
- [BELV.Term, RDF.type, RDF::RDFS.Class],
217
- # Relationships
218
- [BELV.Association, RDF::RDFS.subClassOf, BELV.CorrelativeRelationship],
219
- [BELV.BiomarkerFor, RDF::RDFS.subClassOf, BELV.Relationship],
220
- [BELV.CausesNoChange, RDF::RDFS.subClassOf, BELV.CausalRelationship],
221
- [BELV.CausalRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
222
- [BELV.CorrelativeRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
223
- [BELV.Decreases, RDF::RDFS.subClassOf, BELV.CausalRelationship],
224
- [BELV.Decreases, RDF::RDFS.subClassOf, BELV.NegativeRelationship],
225
- [BELV.DirectlyDecreases, RDF::RDFS.subClassOf, BELV.CausalRelationship],
226
- [BELV.DirectlyDecreases, RDF::RDFS.subClassOf, BELV.NegativeRelationship],
227
- [BELV.DirectlyDecreases, RDF::RDFS.subClassOf, BELV.DirectRelationship],
228
- [BELV.DirectlyDecreases, RDF::RDFS.subClassOf, BELV.Decreases],
229
- [BELV.DirectlyIncreases, RDF::RDFS.subClassOf, BELV.CausalRelationship],
230
- [BELV.DirectlyIncreases, RDF::RDFS.subClassOf, BELV.PositiveRelationship],
231
- [BELV.DirectlyIncreases, RDF::RDFS.subClassOf, BELV.DirectRelationship],
232
- [BELV.DirectlyIncreases, RDF::RDFS.subClassOf, BELV.Increases],
233
- [BELV.DirectRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
234
- [BELV.HasComponent, RDF::RDFS.subClassOf, BELV.MembershipRelationship],
235
- [BELV.HasMember, RDF::RDFS.subClassOf, BELV.MembershipRelationship],
236
- [BELV.Increases, RDF::RDFS.subClassOf, BELV.CausalRelationship],
237
- [BELV.Increases, RDF::RDFS.subClassOf, BELV.PositiveRelationship],
238
- [BELV.IsA, RDF::RDFS.subClassOf, BELV.MembershipRelationship],
239
- [BELV.MembershipRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
240
- [BELV.NegativeCorrelation, RDF::RDFS.subClassOf, BELV.CorrelativeRelationship],
241
- [BELV.NegativeCorrelation, RDF::RDFS.subClassOf, BELV.NegativeRelationship],
242
- [BELV.NegativeRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
243
- [BELV.PositiveCorrelation, RDF::RDFS.subClassOf, BELV.CorrelativeRelationship],
244
- [BELV.PositiveCorrelation, RDF::RDFS.subClassOf, BELV.PositiveRelationship],
245
- [BELV.PositiveRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
246
- [BELV.PrognosticBiomarkerFor, RDF::RDFS.subClassOf, BELV.BiomarkerFor],
247
- [BELV.RateLimitingStepOf, RDF::RDFS.subClassOf, BELV.Increases],
248
- [BELV.RateLimitingStepOf, RDF::RDFS.subClassOf, BELV.CausalRelationship],
249
- [BELV.RateLimitingStepOf, RDF::RDFS.subClassOf, BELV.SubProcessOf],
250
- [BELV.SubProcessOf, RDF::RDFS.subClassOf, BELV.MembershipRelationship],
251
- # Abundances
252
- [BELV.AbundanceActivity, RDF::RDFS.subClassOf, BELV.Process],
253
- [BELV.BiologicalProcess, RDF::RDFS.subClassOf, BELV.Process],
254
- [BELV.CellSecretion, RDF::RDFS.subClassOf, BELV.Translocation],
255
- [BELV.ComplexAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
256
- [BELV.CompositeAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
257
- [BELV.Degradation, RDF::RDFS.subClassOf, BELV.Transformation],
258
- [BELV.GeneAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
259
- [BELV.MicroRNAAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
260
- [BELV.ModifiedProteinAbundance, RDF::RDFS.subClassOf, BELV.ProteinAbundance],
261
- [BELV.Pathology, RDF::RDFS.subClassOf, BELV.BiologicalProcess],
262
- [BELV.Process, RDF.type, RDF::RDFS.Class],
263
- [BELV.ProteinAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
264
- [BELV.ProteinVariantAbundance, RDF::RDFS.subClassOf, BELV.ProteinAbundance],
265
- [BELV.Reaction, RDF::RDFS.subClassOf, BELV.Transformation],
266
- [BELV.RNAAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
267
- [BELV.Transformation, RDF::RDFS.subClassOf, BELV.Process],
268
- [BELV.Translocation, RDF::RDFS.subClassOf, BELV.Transformation],
269
- # Activities
270
- [BELV.Activity, RDF::RDFS.subClassOf, BELV.Activity],
271
- [BELV.Catalytic, RDF::RDFS.subClassOf, BELV.Activity],
272
- [BELV.Chaperone, RDF::RDFS.subClassOf, BELV.Activity],
273
- [BELV.GtpBound, RDF::RDFS.subClassOf, BELV.Activity],
274
- [BELV.Kinase, RDF::RDFS.subClassOf, BELV.Activity],
275
- [BELV.Peptidase, RDF::RDFS.subClassOf, BELV.Activity],
276
- [BELV.Phosphatase, RDF::RDFS.subClassOf, BELV.Activity],
277
- [BELV.Ribosylase, RDF::RDFS.subClassOf, BELV.Activity],
278
- [BELV.Transcription, RDF::RDFS.subClassOf, BELV.Activity],
279
- [BELV.Transport, RDF::RDFS.subClassOf, BELV.Activity],
280
- # Modifications
281
- [BELV.Acetylation, RDF::RDFS.subClassOf, BELV.Modification],
282
- [BELV.Farnesylation, RDF::RDFS.subClassOf, BELV.Modification],
283
- [BELV.Glycosylation, RDF::RDFS.subClassOf, BELV.Modification],
284
- [BELV.Hydroxylation, RDF::RDFS.subClassOf, BELV.Modification],
285
- [BELV.Methylation, RDF::RDFS.subClassOf, BELV.Modification],
286
- [BELV.Phosphorylation, RDF::RDFS.subClassOf, BELV.Modification],
287
- [BELV.Ribosylation, RDF::RDFS.subClassOf, BELV.Modification],
288
- [BELV.Sumoylation, RDF::RDFS.subClassOf, BELV.Modification],
289
- [BELV.Ubiquitination, RDF::RDFS.subClassOf, BELV.Modification],
290
- [BELV.PhosphorylationSerine, RDF::RDFS.subClassOf, BELV.Phosphorylation],
291
- [BELV.PhosphorylationTyrosine, RDF::RDFS.subClassOf, BELV.Phosphorylation],
292
- [BELV.PhosphorylationThreonine, RDF::RDFS.subClassOf, BELV.Phosphorylation],
293
-
294
- # Properties
295
- # Term
296
- [BELV.hasActivityType, RDF.type, RDF.Property],
297
- [BELV.hasActivityType, RDF::RDFS.range, BELV.Activity],
298
- [BELV.hasActivityType, RDF::RDFS.domain, BELV.Term],
299
- [BELV.hasChild, RDF.type, RDF.Property],
300
- [BELV.hasChild, RDF::RDFS.range, BELV.Term],
301
- [BELV.hasChild, RDF::RDFS.domain, BELV.Term],
302
- [BELV.hasConcept, RDF.type, RDF.Property],
303
- [BELV.hasConcept, RDF::RDFS.range, BELV.NamespaceConcept],
304
- [BELV.hasConcept, RDF::RDFS.domain, BELV.Term],
305
- [BELV.hasModificationPosition, RDF.type, RDF.Property],
306
- [BELV.hasModificationPosition, RDF::RDFS.range, RDF::XSD.integer],
307
- [BELV.hasModificationPosition, RDF::RDFS.domain, BELV.Term],
308
- [BELV.hasModificationType, RDF.type, RDF.Property],
309
- [BELV.hasModificationType, RDF::RDFS.range, BELV.Activity],
310
- [BELV.hasModificationType, RDF::RDFS.domain, BELV.Term],
311
- # Statement
312
- [BELV.hasEvidence, RDF.type, RDF.Property],
313
- [BELV.hasEvidence, RDF::RDFS.range, BELV.Evidence],
314
- [BELV.hasEvidence, RDF::RDFS.domain, BELV.Statement],
315
- [BELV.hasObject, RDF::RDFS.subPropertyOf, BELV.hasChild],
316
- [BELV.hasObject, RDF::RDFS.range, BELV.Term],
317
- [BELV.hasObject, RDF::RDFS.domain, BELV.Statement],
318
- [BELV.hasRelationship, RDF.type, RDF.Property],
319
- [BELV.hasRelationship, RDF::RDFS.range, BELV.Relationship],
320
- [BELV.hasRelationship, RDF::RDFS.domain, BELV.Statement],
321
- [BELV.hasSubject, RDF::RDFS.subPropertyOf, BELV.hasChild],
322
- [BELV.hasSubject, RDF::RDFS.range, BELV.Term],
323
- [BELV.hasSubject, RDF::RDFS.domain, BELV.Statement],
324
- # Evidence
325
- [BELV.hasAnnotation, RDF.type, RDF.Property],
326
- [BELV.hasAnnotation, RDF::RDFS.range, BELV.AnnotationConcept],
327
- [BELV.hasAnnotation, RDF::RDFS.domain, BELV.Evidence],
328
- [BELV.hasCitation, RDF.type, RDF.Property],
329
- [BELV.hasCitation, RDF::RDFS.domain, BELV.Evidence],
330
- [BELV.hasEvidenceText, RDF::RDFS.range, RDF::XSD.string],
331
- [BELV.hasEvidenceText, RDF::RDFS.domain, BELV.Evidence],
332
- [BELV.hasStatement, RDF.type, RDF.Property],
333
- [BELV.hasStatement, RDF::RDFS.range, BELV.Statement],
334
- [BELV.hasStatement, RDF::RDFS.domain, BELV.Evidence]
335
- ]
336
- end
337
- end
338
- end
@@ -1,584 +0,0 @@
1
- # Load RDF library dependencies
2
- begin
3
- require 'rdf'
4
- require 'addressable/uri'
5
- require 'uuid'
6
- rescue LoadError => e
7
- # Raise LoadError if the requirements were not met.
8
- raise
9
- end
10
-
11
- require_relative 'bel_rdf'
12
-
13
- # OpenClass to contribute RDF functionality to BEL Model.
14
- class ::BEL::Namespace::NamespaceDefinition
15
-
16
- def to_uri
17
- @rdf_uri
18
- end
19
-
20
- def to_rdf_vocabulary
21
- RUBYRDF::Vocabulary.new("#{@rdf_uri}/")
22
- end
23
- end
24
-
25
- class ::BEL::Model::Parameter
26
-
27
- def to_uri
28
- @ns.to_rdf_vocabulary[URI::encode(@value)]
29
- end
30
-
31
- def to_rdf
32
- uri = to_uri
33
- encodings = ['A'].concat(@enc.to_s.each_char.to_a).uniq
34
- if block_given?
35
- encodings.map { |enc| concept_statement(enc, uri) }.each do |stmt|
36
- yield stmt
37
- end
38
- else
39
- encodings.map { |enc| concept_statement(enc, uri)}
40
- end
41
- end
42
-
43
- private
44
-
45
- def concept_statement(encoding_character, uri)
46
- case encoding_character
47
- when 'G'
48
- RUBYRDF::Statement(uri, RUBYRDF.type, BEL::RDF::BELV.GeneConcept)
49
- when 'R'
50
- RUBYRDF::Statement(uri, RUBYRDF.type, BEL::RDF::BELV.RNAConcept)
51
- when 'P'
52
- RUBYRDF::Statement(uri, RUBYRDF.type, BEL::RDF::BELV.ProteinConcept)
53
- when 'M'
54
- RUBYRDF::Statement(uri, RUBYRDF.type, BEL::RDF::BELV.MicroRNAConcept)
55
- when 'C'
56
- RUBYRDF::Statement(uri, RUBYRDF.type, BEL::RDF::BELV.ComplexConcept)
57
- when 'B'
58
- RUBYRDF::Statement(uri, RUBYRDF.type, BEL::RDF::BELV.BiologicalProcessConcept)
59
- when 'A'
60
- RUBYRDF::Statement(uri, RUBYRDF.type, BEL::RDF::BELV.AbundanceConcept)
61
- when 'O'
62
- RUBYRDF::Statement(uri, RUBYRDF.type, BEL::RDF::BELV.PathologyConcept)
63
- end
64
- end
65
- end
66
-
67
- class BEL::Model::Term
68
-
69
- def to_uri
70
- tid = to_s.squeeze(')').gsub(/[")\[\]]/, '').gsub(/[(:, ]/, '_')
71
- BEL::RDF::BELR[URI::encode(tid)]
72
- end
73
-
74
- def rdf_type
75
- if respond_to? 'fx'
76
- fx = @fx.respond_to?(:short_form) ? @fx.short_form : @fx.to_s.to_sym
77
- if [:p, :proteinAbundance].include?(fx) &&
78
- @arguments.find{ |x|
79
- if x.is_a? BEL::Model::Term
80
- arg_fx = x.fx
81
- arg_fx = arg_fx.respond_to?(:short_form) ? arg_fx.short_form : arg_fx.to_s.to_sym
82
- [:pmod, :proteinModification].include?(arg_fx)
83
- else
84
- false
85
- end
86
- }
87
-
88
- return BEL::RDF::BELV.ModifiedProteinAbundance
89
- end
90
-
91
- if [:p, :proteinAbundance].include?(fx) &&
92
- @arguments.find{ |x|
93
- if x.is_a? BEL::Model::Term
94
- arg_fx = x.fx
95
- arg_fx = arg_fx.respond_to?(:short_form) ? arg_fx.short_form : arg_fx.to_s.to_sym
96
- BEL::RDF::PROTEIN_VARIANT.include?(arg_fx)
97
- else
98
- false
99
- end
100
- }
101
-
102
- return BEL::RDF::BELV.ProteinVariantAbundance
103
- end
104
-
105
- BEL::RDF::FUNCTION_TYPE[fx] || BEL::RDF::BELV.Abundance
106
- end
107
- end
108
-
109
- def to_rdf
110
- uri = to_uri
111
- statements = []
112
-
113
- # rdf:type
114
- type = rdf_type
115
- statements << [uri, BEL::RDF::RDF.type, BEL::RDF::BELV.Term]
116
- statements << [uri, BEL::RDF::RDF.type, type]
117
- fx = @fx.respond_to?(:short_form) ? @fx.short_form : @fx.to_s.to_sym
118
- if BEL::RDF::ACTIVITY_TYPE.include? fx
119
- statements << [uri, BEL::RDF::BELV.hasActivityType, BEL::RDF::ACTIVITY_TYPE[fx]]
120
- end
121
-
122
- # rdfs:label
123
- statements << [uri, BEL::RDF::RDFS.label, to_s.force_encoding('UTF-8')]
124
-
125
- # special proteins (does not recurse into pmod)
126
- if [:p, :proteinAbundance].include?(fx)
127
- pmod =
128
- @arguments.find{ |x|
129
- if x.is_a? BEL::Model::Term
130
- arg_fx = x.fx
131
- arg_fx = arg_fx.respond_to?(:short_form) ? arg_fx.short_form : arg_fx.to_s.to_sym
132
- [:pmod, :proteinModification].include?(arg_fx)
133
- else
134
- false
135
- end
136
- }
137
- if pmod
138
- mod_string = pmod.arguments.map(&:to_s).join(',')
139
- mod_type = BEL::RDF::MODIFICATION_TYPE.find {|k,v| mod_string.start_with? k}
140
- mod_type = (mod_type ? mod_type[1] : BEL::RDF::BELV.Modification)
141
- statements << [uri, BEL::RDF::BELV.hasModificationType, mod_type]
142
- last = pmod.arguments.last.to_s
143
- if last.match(/^\d+$/)
144
- statements << [uri, BEL::RDF::BELV.hasModificationPosition, last.to_i]
145
- end
146
- # link root protein abundance as hasChild
147
- root_param = @arguments.find{|x| x.is_a? BEL::Model::Parameter}
148
- (root_id, root_statements) = BEL::Model::Term.new(:p, [root_param]).to_rdf
149
- statements << [uri, BEL::RDF::BELV.hasChild, root_id]
150
- statements += root_statements
151
- return [uri, statements]
152
- elsif @arguments.find{|x| x.is_a? BEL::Model::Term and BEL::RDF::PROTEIN_VARIANT.include? x.fx}
153
- # link root protein abundance as hasChild
154
- root_param = @arguments.find{|x| x.is_a? BEL::Model::Parameter}
155
- (root_id, root_statements) = BEL::Model::Term.new(:p, [root_param]).to_rdf
156
- statements << [uri, BEL::RDF::BELV.hasChild, root_id]
157
- statements += root_statements
158
- return [uri, statements]
159
- end
160
- end
161
-
162
- # BEL::RDF::BELV.hasConcept]
163
- @arguments.find_all{ |x|
164
- x.is_a? BEL::Model::Parameter and x.ns != nil
165
- }.each do |param|
166
- concept_uri = param.ns.to_rdf_vocabulary[param.value.to_s]
167
- statements << [uri, BEL::RDF::BELV.hasConcept, BEL::RDF::RDF::URI(Addressable::URI.encode(concept_uri))]
168
- end
169
-
170
- # BEL::RDF::BELV.hasChild]
171
- @arguments.find_all{|x| x.is_a? BEL::Model::Term}.each do |child|
172
- (child_id, child_statements) = child.to_rdf
173
- statements << [uri, BEL::RDF::BELV.hasChild, child_id]
174
- statements += child_statements
175
- end
176
-
177
- return [uri, statements]
178
- end
179
- end
180
-
181
- class BEL::Model::Statement
182
-
183
- def to_uri
184
- case
185
- when subject_only?
186
- tid = @subject.to_s.squeeze(')').gsub(/[")\[\]]/, '').gsub(/[(:, ]/, '_')
187
- BEL::RDF::BELR[URI::encode(tid)]
188
- when simple?
189
- sub_id = @subject.to_s.squeeze(')').gsub(/[")\[\]]/, '').gsub(/[(:, ]/, '_')
190
- obj_id = @object.to_s.squeeze(')').gsub(/[")\[\]]/, '').gsub(/[(:, ]/, '_')
191
- rel = BEL::RDF::RELATIONSHIP_TYPE[@relationship.to_s]
192
- if rel
193
- rel = rel.path.split('/')[-1]
194
- else
195
- rel = @relationship.to_s
196
- end
197
- BEL::RDF::BELR[URI::encode("#{sub_id}_#{rel}_#{obj_id}")]
198
- when nested?
199
- sub_id = @subject.to_s.squeeze(')').gsub(/[")\[\]]/, '').gsub(/[(:, ]/, '_')
200
- nsub_id = @object.subject.to_s.squeeze(')').gsub(/[")\[\]]/, '').gsub(/[(:, ]/, '_')
201
- nobj_id = @object.object.to_s.squeeze(')').gsub(/[")\[\]]/, '').gsub(/[(:, ]/, '_')
202
- rel = BEL::RDF::RELATIONSHIP_TYPE[@relationship.to_s]
203
- if rel
204
- rel = rel.path.split('/')[-1]
205
- else
206
- rel = @relationship.to_s
207
- end
208
- nrel = BEL::RDF::RELATIONSHIP_TYPE[@object.relationship.to_s]
209
- if nrel
210
- nrel = nrel.path.split('/')[-1]
211
- else
212
- nrel = @object.relationship.to_s
213
- end
214
- BEL::RDF::BELR[URI::encode("#{sub_id}_#{rel}_#{nsub_id}_#{nrel}_#{nobj_id}")]
215
- end
216
- end
217
-
218
- def to_rdf
219
- uri = to_uri
220
- statements = []
221
-
222
- case
223
- when subject_only?
224
- (sub_uri, sub_statements) = @subject.to_rdf
225
- statements << [uri, BEL::RDF::BELV.hasSubject, sub_uri]
226
- statements += sub_statements
227
- when simple?
228
- (sub_uri, sub_statements) = @subject.to_rdf
229
- statements += sub_statements
230
-
231
- (obj_uri, obj_statements) = @object.to_rdf
232
- statements += obj_statements
233
-
234
- rel = BEL::RDF::RELATIONSHIP_TYPE[@relationship.to_s]
235
- statements << [uri, BEL::RDF::BELV.hasSubject, sub_uri]
236
- statements << [uri, BEL::RDF::BELV.hasObject, obj_uri]
237
- statements << [uri, BEL::RDF::BELV.hasRelationship, rel]
238
- when nested?
239
- (sub_uri, sub_statements) = @subject.to_rdf
240
- (nsub_uri, nsub_statements) = @object.subject.to_rdf
241
- (nobj_uri, nobj_statements) = @object.object.to_rdf
242
- statements += sub_statements
243
- statements += nsub_statements
244
- statements += nobj_statements
245
- rel = BEL::RDF::RELATIONSHIP_TYPE[@relationship.to_s]
246
- nrel = BEL::RDF::RELATIONSHIP_TYPE[@object.relationship.to_s]
247
- nuri = BEL::RDF::BELR["#{strip_prefix(nsub_uri)}_#{nrel}_#{strip_prefix(nobj_uri)}"]
248
-
249
- # inner
250
- statements << [nuri, BEL::RDF::BELV.hasSubject, nsub_uri]
251
- statements << [nuri, BEL::RDF::BELV.hasObject, nobj_uri]
252
- statements << [nuri, BEL::RDF::BELV.hasRelationship, nrel]
253
-
254
- # outer
255
- statements << [uri, BEL::RDF::BELV.hasSubject, sub_uri]
256
- statements << [uri, BEL::RDF::BELV.hasObject, nuri]
257
- statements << [uri, BEL::RDF::BELV.hasRelationship, rel]
258
- end
259
-
260
- # common statement triples
261
- statements << [uri, BEL::RDF::RDF.type, BEL::RDF::BELV.Statement]
262
- statements << [uri, RDF::RDFS.label, to_s.force_encoding('UTF-8')]
263
-
264
- # evidence
265
- evidence_bnode = BEL::RDF::RDF::Node.uuid
266
- statements << [evidence_bnode, BEL::RDF::RDF.type, BEL::RDF::BELV.Evidence]
267
- statements << [uri, BEL::RDF::BELV.hasEvidence, evidence_bnode]
268
- statements << [evidence_bnode, BEL::RDF::BELV.hasStatement, uri]
269
-
270
- # citation
271
- citation = @annotations.delete('Citation')
272
- if citation
273
- value = citation.value.map{|x| x.gsub('"', '')}
274
- if citation and value[0] == 'PubMed'
275
- pid = value[2]
276
- statements << [
277
- evidence_bnode,
278
- BEL::RDF::BELV.hasCitation,
279
- BEL::RDF::RDF::URI(BEL::RDF::PUBMED[pid])
280
- ]
281
- end
282
- end
283
-
284
- # evidence
285
- evidence_text = @annotations.delete('Evidence')
286
- if evidence_text
287
- value = evidence_text.value.gsub('"', '').force_encoding('UTF-8')
288
- statements << [evidence_bnode, BEL::RDF::BELV.hasEvidenceText, value]
289
- end
290
-
291
- # annotations
292
- @annotations.each do |name, anno|
293
- name = anno.name.gsub('"', '')
294
-
295
- if BEL::RDF::const_defined? name
296
- annotation_scheme = BEL::RDF::const_get name
297
- [anno.value].flatten.map{|x| x.gsub('"', '')}.each do |val|
298
- value_uri = BEL::RDF::RDF::URI(Addressable::URI.encode(annotation_scheme[val.to_s]))
299
- statements << [evidence_bnode, BEL::RDF::BELV.hasAnnotation, value_uri]
300
- end
301
- end
302
- end
303
-
304
- return [uri, statements]
305
- end
306
-
307
- private
308
-
309
- def strip_prefix(uri)
310
- if uri.to_s.start_with? 'http://www.openbel.org/bel/'
311
- uri.to_s[28..-1]
312
- else
313
- uri
314
- end
315
- end
316
- end
317
-
318
- module BEL::Extension::Format
319
-
320
- class FormatRDF
321
-
322
- include Formatter
323
- ID = :rdf
324
- MEDIA_TYPES = %i(
325
- application/n-quads
326
- application/n-triples
327
- application/rdf+xml
328
- application/turtle
329
- application/x-turtle
330
- text/turtle
331
- )
332
- EXTENSIONS = %i(
333
- nq
334
- nt
335
- rdf
336
- ttl
337
- )
338
-
339
- def id
340
- ID
341
- end
342
-
343
- def media_types
344
- MEDIA_TYPES
345
- end
346
-
347
- def file_extensions
348
- EXTENSIONS
349
- end
350
-
351
- def deserialize(data)
352
- RDFReader::UnbufferedEvidenceYielder.new(data)
353
- end
354
-
355
- def serialize(objects, writer = StringIO.new, options = {})
356
- format = options[:format] || :ntriples
357
- rdf_writer = RDFWriter::RDFYielder.new(writer, format)
358
-
359
- objects.each do |evidence|
360
- rdf_writer << evidence
361
- end
362
- rdf_writer.done
363
- writer
364
- end
365
- end
366
-
367
- module RDFReader
368
-
369
- module EvidenceYielder
370
-
371
- RDF = BEL::RDF::RDF
372
- RDFS = RDF::RDFS
373
- BELV = BEL::RDF::BELV
374
-
375
- include ::BEL::Model
376
- include ::BEL::Quoting
377
-
378
- # Find described resources by +type+ in +graph+.
379
- #
380
- # @param [RDF::Resource] type the RDF type to find instances for
381
- # @param [RDF::Graph] graph the RDF graph to query
382
- # @return [Enumerator] an enumerator of described resource instances
383
- def resources_of_type(type, graph)
384
- graph.query([nil, RDF.type, type])
385
- .lazy
386
- .map { |rdf_statement|
387
- describe(rdf_statement.subject, graph)
388
- }
389
- end
390
-
391
- # Describes an RDF +resource+ contained within +graph+. Describing an RDF
392
- # resource will retrieve the neighborhood of RDF statements with
393
- # +resource+ in the subject position.
394
- #
395
- # @param [RDF::Resource] resource the RDF resource to describe
396
- # @param [RDF::Graph] graph the RDF graph to query
397
- # @return [Hash] a hash of predicate to object in the
398
- # neighborhood of +resource+
399
- def describe(resource, graph)
400
- graph.query([resource, nil, nil]).reduce({}) { |hash, statement|
401
- hash[statement.predicate] = statement.object
402
- hash
403
- }
404
- end
405
-
406
- # Iterate the {BELV.Evidence} predicated statements, from the
407
- # {RUBYRDF::Graph graph}, and yield those correspdonding {Evidence}
408
- # objects.
409
- #
410
- # @param [RDF::Graph] graph the RDF graph to query
411
- # @yield [evidence_model] yields an {Evidence} object
412
- def evidence_yielder(graph)
413
- resources_of_type(BELV.Evidence, graph).each do |evidence|
414
-
415
- yield make_evidence(evidence, graph)
416
- end
417
- end
418
-
419
- # Create an {Evidence} object from RDF statements found in
420
- # the {RUBYRDF::Graph graph}.
421
- #
422
- # @param [Hash] evidence a hash of predicate to object
423
- # representing the described evidence
424
- # @param [RDF::Graph] graph the RDF graph to query
425
- # @return [Evidence] the evidence model
426
- def make_evidence(evidence, graph)
427
- statement = describe(evidence[BELV.hasStatement], graph)
428
-
429
- # values
430
- bel_statement = statement[RDFS.label].value
431
- ev_text = evidence[BELV.hasEvidenceText]
432
- citation = evidence[BELV.hasCitation]
433
-
434
- # model
435
- ev_model = Evidence.new
436
- ev_model.bel_statement = ::BEL::Script.parse(bel_statement)
437
- .find { |obj|
438
- obj.is_a? Statement
439
- }
440
- ev_model.summary_text = SummaryText.new(ev_text.value) if ev_text
441
-
442
- if citation.respond_to?(:value)
443
- ev_model.citation =
444
- case citation.value
445
- when /pubmed:(\d+)$/
446
- pubmed_id = $1.to_i
447
- Citation.create(
448
- :type => 'PubMed',
449
- :id => pubmed_id,
450
- :name => "PubMed Citation - #{pubmed_id}"
451
- )
452
- else
453
- nil
454
- end
455
- end
456
-
457
- ev_model
458
- end
459
- end
460
-
461
- class BufferedEvidenceYielder
462
-
463
- include EvidenceYielder
464
-
465
- def initialize(data, format = :ntriples)
466
- @data = data
467
- @format = format
468
- end
469
-
470
- def each
471
- if block_given?
472
- graph = RUBYRDF::Graph.new
473
- RUBYRDF::Reader.for(@format).new(@data) do |reader|
474
- reader.each_statement do |statement|
475
- graph << statement
476
- end
477
- end
478
- evidence_yielder(graph) do |evidence_model|
479
- yield evidence_model
480
- end
481
- else
482
- to_enum(:each)
483
- end
484
- end
485
- end
486
-
487
- class UnbufferedEvidenceYielder
488
-
489
- include EvidenceYielder
490
-
491
- def initialize(data, format = :ntriples)
492
- @data = data
493
- @format = format
494
- end
495
-
496
- def each
497
- if block_given?
498
- graph = RUBYRDF::Graph.new
499
- evidence_resource = nil
500
- RUBYRDF::Reader.for(@format).new(@data) do |reader|
501
- reader.each_statement do |statement|
502
- case
503
- when statement.object == BELV.Evidence &&
504
- statement.predicate == RDF.type
505
- evidence_resource = statement.subject
506
- when evidence_resource &&
507
- statement.predicate != BELV.hasEvidence &&
508
- statement.subject != evidence_resource
509
-
510
- # yield current graph as evidence model
511
- yield make_evidence(
512
- describe(evidence_resource, graph),
513
- graph
514
- )
515
-
516
- # reset parse state
517
- graph.clear
518
- evidence_resource = nil
519
-
520
- # insert this RDF statement
521
- graph << statement
522
- else
523
- graph << statement
524
- end
525
- end
526
- end
527
-
528
- # yield last graph as evidence model
529
- yield make_evidence(
530
- describe(evidence_resource, graph),
531
- graph
532
- )
533
- else
534
- to_enum(:each)
535
- end
536
- end
537
- end
538
- end
539
-
540
- module RDFWriter
541
-
542
- class RDFYielder
543
- attr_reader :writer
544
-
545
- def initialize(io, format)
546
- rdf_writer = find_writer(format)
547
- @writer = rdf_writer.new(io, { :stream => true })
548
- end
549
-
550
- def <<(evidence)
551
- triples = evidence.bel_statement.to_rdf[1]
552
- triples.each do |triple|
553
- @writer.write_statement(RDF::Statement(*triple))
554
- end
555
- end
556
-
557
- def done
558
- @writer.write_epilogue
559
- end
560
-
561
- private
562
-
563
- def find_writer(format)
564
- case format.to_s.to_sym
565
- when :nquads
566
- BEL::RDF::RDF::NQuads::Writer
567
- when :turtle
568
- begin
569
- require 'rdf/turtle'
570
- BEL::RDF::RDF::Turtle::Writer
571
- rescue LoadError
572
- $stderr.puts """Turtle format not supported.
573
- Install the 'rdf-turtle' gem."""
574
- raise
575
- end
576
- when :ntriples
577
- BEL::RDF::RDF::NTriples::Writer
578
- end
579
- end
580
- end
581
- end
582
-
583
- register_formatter(FormatRDF.new)
584
- end