biointerchange 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. data/README.md +61 -18
  2. data/VERSION +1 -1
  3. data/examples/Saccharomyces_cerevisiae_incl_consequences.gvf.gz +0 -0
  4. data/examples/webservice_example.json +7 -0
  5. data/generators/GOxrefify.rb +36 -28
  6. data/generators/javaify.rb +131 -112
  7. data/generators/make_supplement_releases.rb +57 -0
  8. data/generators/pythonify.rb +68 -53
  9. data/lib/biointerchange/core.rb +4 -2
  10. data/lib/biointerchange/faldo.rb +160 -0
  11. data/lib/biointerchange/genomics/gff3_feature_set.rb +1 -1
  12. data/lib/biointerchange/genomics/gff3_rdf_ntriples.rb +1 -1
  13. data/lib/biointerchange/genomics/gff3_reader.rb +1 -1
  14. data/lib/biointerchange/model.rb +21 -0
  15. data/lib/biointerchange/registry.rb +1 -1
  16. data/lib/biointerchange/sio.rb +2035 -57
  17. data/lib/biointerchange/textmining/document.rb +1 -1
  18. data/lib/biointerchange/textmining/pdfx_xml_reader.rb +1 -15
  19. data/lib/biointerchange/textmining/pubannos_json_reader.rb +1 -3
  20. data/spec/gff3_rdfwriter_spec.rb +1 -0
  21. data/spec/gvf_rdfwriter_spec.rb +1 -0
  22. data/spec/text_mining_pdfx_xml_reader_spec.rb +4 -3
  23. data/spec/text_mining_pubannos_json_reader_spec.rb +6 -5
  24. data/spec/text_mining_rdfwriter_spec.rb +2 -1
  25. data/supplemental/java/biointerchange/pom.xml +1 -1
  26. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/FALDO.java +219 -0
  27. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/GFF3O.java +2 -1
  28. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/GOXRef.java +1221 -0
  29. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/GVF1O.java +2 -1
  30. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/SIO.java +2283 -15
  31. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/SO.java +2 -1
  32. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/SOFA.java +5 -4
  33. data/supplemental/python/biointerchange/faldo.py +168 -0
  34. data/supplemental/python/biointerchange/gff3o.py +6 -4
  35. data/supplemental/python/biointerchange/goxref.py +1040 -0
  36. data/supplemental/python/biointerchange/gvf1o.py +6 -4
  37. data/supplemental/python/biointerchange/sio.py +1740 -21
  38. data/supplemental/python/biointerchange/so.py +6527 -6525
  39. data/supplemental/python/biointerchange/sofa.py +792 -790
  40. data/supplemental/python/setup.py +2 -2
  41. data/web/about.html +9 -29
  42. data/web/api.html +10 -30
  43. data/web/biointerchange.js +78 -27
  44. data/web/cli.html +137 -0
  45. data/web/index.html +19 -34
  46. data/web/ontologies.html +9 -29
  47. data/web/service/rdfizer.fcgi +19 -2
  48. data/web/webservices.html +70 -35
  49. metadata +13 -3
@@ -1,6 +1,6 @@
1
1
  module BioInterchange::TextMining
2
2
 
3
- class Document
3
+ class Document < BioInterchange::Model
4
4
 
5
5
  # Creates a blank document representation.
6
6
  #
@@ -3,7 +3,7 @@ module BioInterchange::TextMining
3
3
  require 'rexml/document'
4
4
  require 'rexml/streamlistener'
5
5
 
6
- class PdfxXmlReader < BioInterchange::TextMining::TMReader
6
+ class PDFxXMLReader < BioInterchange::TextMining::TMReader
7
7
 
8
8
  # Reads input stream and returns associated +BioInterchange::TextMining::Document+ model
9
9
  #
@@ -14,7 +14,6 @@ class PdfxXmlReader < BioInterchange::TextMining::TMReader
14
14
  #
15
15
  # +inputstream+:: Input IO stream to deserialize
16
16
  def deserialize(inputstream)
17
-
18
17
  #super(inputstream)
19
18
 
20
19
  raise BioInterchange::Exceptions::ImplementationReaderError, 'InputStream not of type IO, cannot read.' unless inputstream.kind_of?(IO) or inputstream.kind_of?(String)
@@ -22,11 +21,8 @@ class PdfxXmlReader < BioInterchange::TextMining::TMReader
22
21
  @input = inputstream
23
22
 
24
23
  pdfx
25
-
26
24
  end
27
25
 
28
-
29
-
30
26
  private
31
27
 
32
28
  def pdfx
@@ -35,11 +31,7 @@ private
35
31
  return list.document
36
32
  end
37
33
 
38
-
39
-
40
-
41
34
  class MyListener
42
-
43
35
  include REXML::StreamListener
44
36
 
45
37
  def initialize
@@ -50,7 +42,6 @@ private
50
42
  @map['sec_l'] = []
51
43
  end
52
44
 
53
-
54
45
  def tag_start(name, attr)
55
46
  #puts "tag_start: #{name}"
56
47
  if name =~ /^job$/
@@ -83,9 +74,7 @@ private
83
74
  end
84
75
  end
85
76
 
86
-
87
77
  def text(data)
88
-
89
78
  if @map['art']
90
79
  @map['art_l'] += data.length
91
80
  end
@@ -106,7 +95,6 @@ private
106
95
  @map['sec_l'][i] += data.length
107
96
  end
108
97
  end
109
-
110
98
  end
111
99
 
112
100
  #TODO add deal with <author> type tags
@@ -153,8 +141,6 @@ private
153
141
  end
154
142
 
155
143
  end
156
-
157
-
158
144
 
159
145
  end
160
146
 
@@ -3,7 +3,7 @@ module BioInterchange::TextMining
3
3
  require 'rubygems'
4
4
  require 'json'
5
5
 
6
- class PubannosJsonReader < BioInterchange::TextMining::TMReader
6
+ class PubAnnosJSONReader < BioInterchange::TextMining::TMReader
7
7
 
8
8
  def deserialize(inputstream)
9
9
  if inputstream.kind_of?(IO) then
@@ -20,13 +20,11 @@ private
20
20
 
21
21
  # Specific method for parsing of *Pubannotations* json format
22
22
  def pubannos(data)
23
-
24
23
  result = JSON.parse(data)
25
24
 
26
25
  if result.has_key? 'Error'
27
26
  raise BioInterchange::Exceptions::InputFormatError, 'Error parsing the JSON input file: #{result["Error"]}'
28
27
  end
29
-
30
28
 
31
29
  text = result['text']
32
30
  #doc_uri = "http://pubannotation.dbcls.jp/pmdocs/" + result['pmid'].to_s
@@ -10,6 +10,7 @@ load 'lib/biointerchange/core.rb'
10
10
  load 'lib/biointerchange/gff3o.rb'
11
11
  load 'lib/biointerchange/sofa.rb'
12
12
  load 'lib/biointerchange/reader.rb'
13
+ load 'lib/biointerchange/model.rb'
13
14
  load 'lib/biointerchange/writer.rb'
14
15
  load 'lib/biointerchange/genomics/gff3_rdf_ntriples.rb'
15
16
  load 'lib/biointerchange/genomics/gff3_feature_set.rb'
@@ -10,6 +10,7 @@ load 'lib/biointerchange/core.rb'
10
10
  load 'lib/biointerchange/gvf1o.rb'
11
11
  load 'lib/biointerchange/sofa.rb'
12
12
  load 'lib/biointerchange/reader.rb'
13
+ load 'lib/biointerchange/model.rb'
13
14
  load 'lib/biointerchange/writer.rb'
14
15
  load 'lib/biointerchange/genomics/gvf_feature_set.rb'
15
16
  load 'lib/biointerchange/genomics/gvf_feature.rb'
@@ -8,6 +8,7 @@ require 'rspec'
8
8
  v, $VERBOSE = $VERBOSE, nil
9
9
  load 'lib/biointerchange/core.rb'
10
10
  load 'lib/biointerchange/reader.rb'
11
+ load 'lib/biointerchange/model.rb'
11
12
  load 'lib/biointerchange/textmining/text_mining_reader.rb'
12
13
  load 'lib/biointerchange/textmining/pdfx_xml_reader.rb'
13
14
  load 'lib/biointerchange/textmining/document.rb'
@@ -15,12 +16,12 @@ load 'lib/biointerchange/textmining/content.rb'
15
16
  load 'lib/biointerchange/textmining/process.rb'
16
17
  $VERBOSE = v
17
18
 
18
- describe BioInterchange::TextMining::PdfxXmlReader do
19
+ describe BioInterchange::TextMining::PDFxXMLReader do
19
20
  describe 'deserialization of pdfx text-mining documents' do
20
21
 
21
22
  describe 'IO check' do
22
23
  before :all do
23
- @reader = BioInterchange::TextMining::PdfxXmlReader.new("Test", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
24
+ @reader = BioInterchange::TextMining::PDFxXMLReader.new("Test", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
24
25
  end
25
26
  it 'reader is not postponed upon instantiation' do
26
27
  @reader.postponed?.should eql false
@@ -40,7 +41,7 @@ describe BioInterchange::TextMining::PdfxXmlReader do
40
41
  describe 'generated model check' do
41
42
 
42
43
  before :all do
43
- reader = BioInterchange::TextMining::PdfxXmlReader.new("Test", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
44
+ reader = BioInterchange::TextMining::PDFxXMLReader.new("Test", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
44
45
 
45
46
  @model = reader.deserialize("<pdfx><job>rspec_test</job><article><article-title>TITLE</article-title><abstract>ABSTRACT</abstract><body>BODY TEXT<section>SECTION LEVEL 1<section>SECTION LEVEL 2.1</section><section>SECTION LEVEL 2.2</section>END SECTION LEVEL 1</section></body></article></pdfx>")
46
47
 
@@ -8,6 +8,7 @@ require 'rspec'
8
8
  v, $VERBOSE = $VERBOSE, nil
9
9
  load 'lib/biointerchange/core.rb'
10
10
  load 'lib/biointerchange/reader.rb'
11
+ load 'lib/biointerchange/model.rb'
11
12
  load 'lib/biointerchange/textmining/text_mining_reader.rb'
12
13
  load 'lib/biointerchange/textmining/pubannos_json_reader.rb'
13
14
  load 'lib/biointerchange/textmining/document.rb'
@@ -16,12 +17,12 @@ load 'lib/biointerchange/textmining/content_connection.rb'
16
17
  load 'lib/biointerchange/textmining/process.rb'
17
18
  $VERBOSE = v
18
19
 
19
- describe BioInterchange::TextMining::PubannosJsonReader do
20
+ describe BioInterchange::TextMining::PubAnnosJSONReader do
20
21
  describe 'deserialization of pubannos json text-mining documents' do
21
22
 
22
23
  describe 'IO check' do
23
24
  before :all do
24
- @reader = BioInterchange::TextMining::PubannosJsonReader.new("Test", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
25
+ @reader = BioInterchange::TextMining::PubAnnosJSONReader.new("Test", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
25
26
  end
26
27
  it 'reader is not postponed upon instantiation' do
27
28
  @reader.postponed?.should eql false
@@ -46,7 +47,7 @@ describe BioInterchange::TextMining::PubannosJsonReader do
46
47
 
47
48
  describe 'old json generated model checks' do
48
49
  before :all do
49
- reader = BioInterchange::TextMining::PubannosJsonReader.new("TestOld", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
50
+ reader = BioInterchange::TextMining::PubAnnosJSONReader.new("TestOld", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
50
51
 
51
52
  @model = reader.deserialize('{ "name": "Peter Smith", "name_id": "<peter.smith@example.json>", "date": "2012-08-12", "version": "3", "docurl":"http://example.org/example_json", "text":"Some document text. With two annotations of type protein.\n", "catanns":[{"annset_id":1,"begin":0,"category":"Protein","doc_id":9,"end":10,"id":139},{"annset_id":1,"begin":20,"category":"Protein","doc_id":9,"end":42,"id":138}]}')
52
53
 
@@ -78,7 +79,7 @@ describe BioInterchange::TextMining::PubannosJsonReader do
78
79
  describe 'basic generated model checks' do
79
80
 
80
81
  before :all do
81
- reader = BioInterchange::TextMining::PubannosJsonReader.new("Test", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
82
+ reader = BioInterchange::TextMining::PubAnnosJSONReader.new("Test", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
82
83
 
83
84
  @model = reader.deserialize('{ "name": "Peter Smith", "name_id": "<peter.smith@example.json>", "date": "2012-12-08", "version": "3", "docurl":"http://example.org/example_json", "text":"Some document text. With two annotations of type protein.\n", "catanns":[{"id":"T1","span":{"begin":0,"end":10},"category":"NP"},{"id":"T2","span":{"begin":20,"end":42},"category":"NP"}]}')
84
85
  end
@@ -108,7 +109,7 @@ describe BioInterchange::TextMining::PubannosJsonReader do
108
109
  describe 'advanced generated model checks' do
109
110
 
110
111
  before :all do
111
- reader = BioInterchange::TextMining::PubannosJsonReader.new("Test", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
112
+ reader = BioInterchange::TextMining::PubAnnosJSONReader.new("Test", "http://test.com", "00-00-0000", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
112
113
 
113
114
  @model = reader.deserialize(File.new('examples/pubannotation.2626671.json'))
114
115
  end
@@ -9,6 +9,7 @@ v, $VERBOSE = $VERBOSE, nil
9
9
  load 'lib/biointerchange/core.rb'
10
10
  load 'lib/biointerchange/sio.rb'
11
11
  load 'lib/biointerchange/reader.rb'
12
+ load 'lib/biointerchange/model.rb'
12
13
  load 'lib/biointerchange/writer.rb'
13
14
  load 'lib/biointerchange/textmining/text_mining_rdf_ntriples.rb'
14
15
  load 'lib/biointerchange/textmining/document.rb'
@@ -61,7 +62,7 @@ describe BioInterchange::TextMining::RDFWriter do
61
62
 
62
63
  it 'full advanced json document' do
63
64
  ostream = StringIO.new
64
- reader = BioInterchange::TextMining::PubannosJsonReader.new("Test", "http://test.com", "2012-12-09", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
65
+ reader = BioInterchange::TextMining::PubAnnosJSONReader.new("Test", "http://test.com", "2012-12-09", BioInterchange::TextMining::Process::UNSPECIFIED, "0.0")
65
66
 
66
67
  model = reader.deserialize(File.new('examples/pubannotation.2626671.json'))
67
68
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  <groupId>org.biointerchange</groupId>
6
6
  <artifactId>vocabularies</artifactId>
7
- <version>0.2.1</version>
7
+ <version>0.2.2</version>
8
8
  <packaging>jar</packaging>
9
9
 
10
10
  <name>BioInterchange Vocabularies</name>
@@ -0,0 +1,219 @@
1
+ package org.biointerchange.vocabulary;
2
+ import java.util.Arrays;
3
+ import java.util.Map;
4
+ import java.util.HashMap;
5
+ import java.util.HashSet;
6
+ import java.util.Set;
7
+ import com.hp.hpl.jena.rdf.model.Property;
8
+ import com.hp.hpl.jena.rdf.model.Resource;
9
+ import com.hp.hpl.jena.rdf.model.ResourceFactory;
10
+ import org.apache.commons.collections.CollectionUtils;
11
+ import org.apache.commons.collections.Predicate;
12
+
13
+
14
+ public class FALDO {
15
+
16
+ /**
17
+ * This denotes that a feature is in between two other positions that are both known exactly and next to eaxh other. An example is an restriction enzyme cutting site. The cut is after one nucleotide and before the next i.e. in between
18
+ * (http://biohackathon.org/resource/faldo#InBetweenPosition)
19
+ */
20
+ public static Resource In_between_positions() {
21
+ return _namespace_FALDO("http://biohackathon.org/resource/faldo#InBetweenPosition");
22
+ }
23
+
24
+ /**
25
+ * Superclass to group the general concept of a position on a sequence. The sequence is designated via the reference predicate.
26
+ * (http://biohackathon.org/resource/faldo#Position)
27
+ */
28
+ public static Resource Position() {
29
+ return _namespace_FALDO("http://biohackathon.org/resource/faldo#Position");
30
+ }
31
+
32
+ /**
33
+ * Use when you exactly know the position.
34
+ * (http://biohackathon.org/resource/faldo#ExactPosition)
35
+ */
36
+ public static Resource Exact_position() {
37
+ return _namespace_FALDO("http://biohackathon.org/resource/faldo#ExactPosition");
38
+ }
39
+
40
+ /**
41
+ * The position must be one of the more detailed Positions listed by the location predicate.
42
+ * (http://biohackathon.org/resource/faldo#OneOfPosition)
43
+ */
44
+ public static Resource One_of_positions() {
45
+ return _namespace_FALDO("http://biohackathon.org/resource/faldo#OneOfPosition");
46
+ }
47
+
48
+ /**
49
+ * Use when you have an idea of the range in which you can find the position but can not be sure.
50
+ * (http://biohackathon.org/resource/faldo#InRangePosition)
51
+ */
52
+ public static Resource Indeterminate_position_within_a_range() {
53
+ return _namespace_FALDO("http://biohackathon.org/resource/faldo#InRangePosition");
54
+ }
55
+
56
+ /**
57
+ * Part of the coordinate system is on which strand the feature can be found. If you do not yet know which stand the feature is on you should tag the position with just this class. If you know more you should use one of the subclasses. This means a region descibred with a "." in GFF3. An GFF3 Unstranded position does not have this type in FALDO those are just a Position.
58
+ * (http://biohackathon.org/resource/faldo#StrandedPosition)
59
+ */
60
+ public static Resource Stranded_position() {
61
+ return _namespace_FALDO("http://biohackathon.org/resource/faldo#StrandedPosition");
62
+ }
63
+
64
+ /**
65
+ * Use this class to indicate that you lack exact position data.
66
+ * (http://biohackathon.org/resource/faldo#FuzzyPosition)
67
+ */
68
+ public static Resource Fuzzy_position() {
69
+ return _namespace_FALDO("http://biohackathon.org/resource/faldo#FuzzyPosition");
70
+ }
71
+
72
+ /**
73
+ * The position is on the forward (positive) strand. Shown as a "+" in GFF3 and GTF
74
+ * (http://biohackathon.org/resource/faldo#ForwardStrandPosition)
75
+ */
76
+ public static Resource Positive_strand() {
77
+ return _namespace_FALDO("http://biohackathon.org/resource/faldo#ForwardStrandPosition");
78
+ }
79
+
80
+ /**
81
+ * The both strands position mean that the region spans both strands instead of one. In GGF3 displayed as 0. This does not mean that the position is one or the other strand but is best described as being on both.
82
+ * (http://biohackathon.org/resource/faldo#BothStrandsPosition)
83
+ */
84
+ public static Resource Both_strands() {
85
+ return _namespace_FALDO("http://biohackathon.org/resource/faldo#BothStrandsPosition");
86
+ }
87
+
88
+ /**
89
+ * The position is on the reverse (complement) strand of the sequence. Shown as "-" in GTF and GFF3
90
+ * (http://biohackathon.org/resource/faldo#ReverseStrandPosition)
91
+ */
92
+ public static Resource Negative_strand() {
93
+ return _namespace_FALDO("http://biohackathon.org/resource/faldo#ReverseStrandPosition");
94
+ }
95
+
96
+ /**
97
+ * A region describes an length of sequence with a start and end position that represents a feature on a Sequence. i.e. a gene
98
+ * (http://biohackathon.org/resource/faldo#Region)
99
+ */
100
+ public static Resource Region() {
101
+ return _namespace_FALDO("http://biohackathon.org/resource/faldo#Region");
102
+ }
103
+
104
+ /**
105
+ * Determines whether the given URI is an object property.
106
+ *
107
+ * @param uri URI that is tested for being an object property
108
+ */
109
+ public static boolean isObjectProperty(Resource uri) {
110
+ return false;
111
+ }
112
+
113
+ /**
114
+ * Determines whether the given URI is a datatype property.
115
+ *
116
+ * @param uri URI that is tested for being a datatype property
117
+ */
118
+ public static boolean isDatatypeProperty(Resource uri) {
119
+ return false;
120
+ }
121
+
122
+ /**
123
+ * Determines whether the given URI is a class.
124
+ *
125
+ * @param uri URI that is tested for being a class
126
+ */
127
+ public static boolean isClass(Resource uri) {
128
+ if (uri == _namespace_FALDO("http://biohackathon.org/resource/faldo#InBetweenPosition")) {
129
+ return true;
130
+ }
131
+ if (uri == _namespace_FALDO("http://biohackathon.org/resource/faldo#Position")) {
132
+ return true;
133
+ }
134
+ if (uri == _namespace_FALDO("http://biohackathon.org/resource/faldo#ExactPosition")) {
135
+ return true;
136
+ }
137
+ if (uri == _namespace_FALDO("http://biohackathon.org/resource/faldo#OneOfPosition")) {
138
+ return true;
139
+ }
140
+ if (uri == _namespace_FALDO("http://biohackathon.org/resource/faldo#InRangePosition")) {
141
+ return true;
142
+ }
143
+ if (uri == _namespace_FALDO("http://biohackathon.org/resource/faldo#StrandedPosition")) {
144
+ return true;
145
+ }
146
+ if (uri == _namespace_FALDO("http://biohackathon.org/resource/faldo#FuzzyPosition")) {
147
+ return true;
148
+ }
149
+ if (uri == _namespace_FALDO("http://biohackathon.org/resource/faldo#ForwardStrandPosition")) {
150
+ return true;
151
+ }
152
+ if (uri == _namespace_FALDO("http://biohackathon.org/resource/faldo#BothStrandsPosition")) {
153
+ return true;
154
+ }
155
+ if (uri == _namespace_FALDO("http://biohackathon.org/resource/faldo#ReverseStrandPosition")) {
156
+ return true;
157
+ }
158
+ if (uri == _namespace_FALDO("http://biohackathon.org/resource/faldo#Region")) {
159
+ return true;
160
+ }
161
+ return false;
162
+ }
163
+
164
+ /**
165
+ * Determines whether the given URI is a named individual.
166
+ *
167
+ * @param uri URI that is tested for being a named individual
168
+ */
169
+ public static boolean isNamedIndividual(Resource uri) {
170
+ return false;
171
+ }
172
+
173
+ /**
174
+ * Returns only those URIs that fall under a designated parent URI.
175
+ *
176
+ * @param uris Set of URIs that are tested whether they have the given parent URI.
177
+ * @param parent Parent URI.
178
+ */
179
+ public static Set<Resource> withParent(Set<Resource> uris, final Resource parent) {
180
+ return new HashSet<Resource>(CollectionUtils.select(uris, new Predicate() { public boolean evaluate(Object uri) { return hasParent((Resource)uri, parent); } }));
181
+ }
182
+
183
+ /**
184
+ * Recursively tries to determine the parent for a given URI.
185
+ *
186
+ * @param uri URI that is tested for whether it has the given parent URI.
187
+ * @param parent Parent URI.
188
+ */
189
+ public static boolean hasParent(Resource uri, Resource parent) {
190
+ if (__parent_properties.containsKey(uri)) {
191
+ if (__parent_properties.get(uri) == parent) {
192
+ return true;
193
+ }
194
+ return hasParent((Resource)__parent_properties.get(uri), parent);
195
+ }
196
+ return false;
197
+ }
198
+
199
+ private static Resource _namespace_FALDO(String accession) {
200
+ if (isClass(ResourceFactory.createResource("http://biohackathon.org/resource/faldo#" + accession))) {
201
+ return ResourceFactory.createResource("http://biohackathon.org/resource/faldo#" + accession);
202
+ } else {
203
+ return ResourceFactory.createProperty("http://biohackathon.org/resource/faldo#" + accession);
204
+ }
205
+ }
206
+
207
+
208
+ private static Map<Resource, Resource> __parent_properties = _init___parent_properties();
209
+
210
+ private static Map<Resource, Resource> _init___parent_properties() {
211
+ Map<Resource, Resource> map = new HashMap<Resource, Resource>();
212
+
213
+
214
+ return map;
215
+ }
216
+
217
+
218
+ }
219
+