bio-publisci 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +13 -0
  4. data/Gemfile +24 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +47 -0
  7. data/README.rdoc +48 -0
  8. data/Rakefile +70 -0
  9. data/bin/bio-publisci +83 -0
  10. data/features/create_generator.feature +25 -0
  11. data/features/integration.feature +12 -0
  12. data/features/integration_steps.rb +10 -0
  13. data/features/orm.feature +60 -0
  14. data/features/orm_steps.rb +74 -0
  15. data/features/reader.feature +25 -0
  16. data/features/reader_steps.rb +60 -0
  17. data/features/step_definitions/bio-publisci_steps.rb +0 -0
  18. data/features/store.feature +27 -0
  19. data/features/store_steps.rb +42 -0
  20. data/features/support/env.rb +13 -0
  21. data/features/writer.feature +9 -0
  22. data/features/writer_steps.rb +17 -0
  23. data/lib/bio-publisci/analyzer.rb +57 -0
  24. data/lib/bio-publisci/dataset/ORM/data_cube_orm.rb +219 -0
  25. data/lib/bio-publisci/dataset/ORM/observation.rb +20 -0
  26. data/lib/bio-publisci/dataset/data_cube.rb +308 -0
  27. data/lib/bio-publisci/dataset/interactive.rb +57 -0
  28. data/lib/bio-publisci/loader.rb +36 -0
  29. data/lib/bio-publisci/metadata/metadata.rb +105 -0
  30. data/lib/bio-publisci/parser.rb +64 -0
  31. data/lib/bio-publisci/query/query_helper.rb +114 -0
  32. data/lib/bio-publisci/r_client.rb +54 -0
  33. data/lib/bio-publisci/readers/arff.rb +87 -0
  34. data/lib/bio-publisci/readers/big_cross.rb +119 -0
  35. data/lib/bio-publisci/readers/cross.rb +72 -0
  36. data/lib/bio-publisci/readers/csv.rb +54 -0
  37. data/lib/bio-publisci/readers/dataframe.rb +66 -0
  38. data/lib/bio-publisci/readers/r_matrix.rb +152 -0
  39. data/lib/bio-publisci/store.rb +56 -0
  40. data/lib/bio-publisci/writers/arff.rb +66 -0
  41. data/lib/bio-publisci/writers/dataframe.rb +81 -0
  42. data/lib/bio-publisci.rb +36 -0
  43. data/lib/r2rdf.rb +226 -0
  44. data/lib/template_bak/publisci.rb +3 -0
  45. data/lib/template_bak.rb +12 -0
  46. data/lib/vocabs/cc.rb +18 -0
  47. data/lib/vocabs/cert.rb +13 -0
  48. data/lib/vocabs/dc.rb +63 -0
  49. data/lib/vocabs/dc11.rb +23 -0
  50. data/lib/vocabs/doap.rb +45 -0
  51. data/lib/vocabs/exif.rb +168 -0
  52. data/lib/vocabs/foaf.rb +69 -0
  53. data/lib/vocabs/geo.rb +13 -0
  54. data/lib/vocabs/http.rb +26 -0
  55. data/lib/vocabs/ma.rb +78 -0
  56. data/lib/vocabs/owl.rb +59 -0
  57. data/lib/vocabs/rdfs.rb +17 -0
  58. data/lib/vocabs/rsa.rb +12 -0
  59. data/lib/vocabs/rss.rb +14 -0
  60. data/lib/vocabs/sioc.rb +93 -0
  61. data/lib/vocabs/skos.rb +36 -0
  62. data/lib/vocabs/wot.rb +21 -0
  63. data/lib/vocabs/xhtml.rb +9 -0
  64. data/lib/vocabs/xsd.rb +58 -0
  65. data/resources/queries/codes.rq +13 -0
  66. data/resources/queries/dataset.rq +7 -0
  67. data/resources/queries/dimension_ranges.rq +8 -0
  68. data/resources/queries/dimensions.rq +7 -0
  69. data/resources/queries/measures.rq +7 -0
  70. data/resources/queries/observations.rq +12 -0
  71. data/resources/queries/test.rq +3 -0
  72. data/resources/weather.numeric.arff +23 -0
  73. data/spec/analyzer_spec.rb +36 -0
  74. data/spec/bio-publisci_spec.rb +7 -0
  75. data/spec/csv/bacon.csv +4 -0
  76. data/spec/csv/moar_bacon.csv +11 -0
  77. data/spec/data_cube_spec.rb +166 -0
  78. data/spec/generators/csv_spec.rb +44 -0
  79. data/spec/generators/dataframe_spec.rb +44 -0
  80. data/spec/generators/r_matrix_spec.rb +35 -0
  81. data/spec/queries/integrity/1.rq +21 -0
  82. data/spec/queries/integrity/11.rq +29 -0
  83. data/spec/queries/integrity/12.rq +37 -0
  84. data/spec/queries/integrity/14.rq +25 -0
  85. data/spec/queries/integrity/19_1.rq +21 -0
  86. data/spec/queries/integrity/19_2.rq +15 -0
  87. data/spec/queries/integrity/2.rq +22 -0
  88. data/spec/queries/integrity/3.rq +19 -0
  89. data/spec/queries/integrity/4.rq +13 -0
  90. data/spec/queries/integrity/5.rq +14 -0
  91. data/spec/r_builder_spec.rb +33 -0
  92. data/spec/spec_helper.rb +17 -0
  93. data/spec/turtle/bacon +149 -0
  94. data/spec/turtle/reference +2066 -0
  95. metadata +259 -0
data/lib/vocabs/ma.rb ADDED
@@ -0,0 +1,78 @@
1
+ module RDF
2
+ ##
3
+ # W3C Media Annotation vocabulary.
4
+ # @see www.w3.org/ns/ma-ont.rdf
5
+ class MA < Vocabulary("http://www.w3.org/ns/ma-ont#")
6
+ property :IsRatingOf
7
+ property :alternativeTitle
8
+ property :averageBitRate
9
+ property :collectionName
10
+ property :copyright
11
+ property :createdIn
12
+ property :creationDate
13
+ property :date
14
+ property :depictsFictionalLocation
15
+ property :description
16
+ property :duration
17
+ property :editDate
18
+ property :features
19
+ property :fragmentName
20
+ property :frameHeight
21
+ property :frameRate
22
+ property :frameSizeUnit
23
+ property :frameWidth
24
+ property :hasAccessConditions
25
+ property :hasAudioDescription
26
+ property :hasCaptioning
27
+ property :hasChapter
28
+ property :hasClassification
29
+ property :hasClassificationSystem
30
+ property :hasCompression
31
+ property :hasContributor
32
+ property :hasCreator
33
+ property :hasFormat
34
+ property :hasFragment
35
+ property :hasGenre
36
+ property :hasKeyword
37
+ property :hasLanguage
38
+ property :hasLocationCoordinateSystem
39
+ property :hasNamedFragment
40
+ property :hasPermissions
41
+ property :hasPolicy
42
+ property :hasPublished
43
+ property :hasPublisher
44
+ property :hasRating
45
+ property :hasRatingSystem
46
+ property :hasRelatedImage
47
+ property :hasRelatedLocation
48
+ property :hasRelatedResource
49
+ property :hasSigning
50
+ property :hasSource
51
+ property :hasSubtitling
52
+ property :hasTargetAudience
53
+ property :hasTrack
54
+ property :isChapterOf
55
+ property :isCopyrightedBy
56
+ property :isLocationRelatedTo
57
+ property :isMemberOf
58
+ property :isProvidedBy
59
+ property :isRelatedTo
60
+ property :isSourceOf
61
+ property :isTargetAudienceOf
62
+ property :locationAltitude
63
+ property :locationLatitude
64
+ property :locationLongitude
65
+ property :locationName
66
+ property :locator
67
+ property :mainOriginalTitle
68
+ property :numberOfTracks
69
+ property :ratingScaleMax
70
+ property :ratingScaleMin
71
+ property :ratingValue
72
+ property :recordDate
73
+ property :releaseDate
74
+ property :samplingRate
75
+ property :title
76
+ property :trackName
77
+ end
78
+ end
data/lib/vocabs/owl.rb ADDED
@@ -0,0 +1,59 @@
1
+ module RDF
2
+ ##
3
+ # Web Ontology Language (OWL) vocabulary.
4
+ #
5
+ # @see http://www.w3.org/TR/owl-overview/
6
+ class OWL < Vocabulary("http://www.w3.org/2002/07/owl#")
7
+ property :allValuesFrom
8
+ property :annotatedProperty
9
+ property :annotatedSource
10
+ property :annotatedTarget
11
+ property :assertionProperty
12
+ property :backwardCompatibleWith
13
+ property :bottomDataProperty
14
+ property :bottomObjectProperty
15
+ property :cardinality
16
+ property :complementOf
17
+ property :datatypeComplementOf
18
+ property :deprecated
19
+ property :differentFrom
20
+ property :disjointUnionOf
21
+ property :disjointWith
22
+ property :distinctMembers
23
+ property :equivalentClass
24
+ property :equivalentProperty
25
+ property :hasKey
26
+ property :hasSelf
27
+ property :hasValue
28
+ property :imports
29
+ property :incompatibleWith
30
+ property :intersectionOf
31
+ property :inverseOf
32
+ property :maxCardinality
33
+ property :maxQualifiedCardinality
34
+ property :members
35
+ property :minCardinality
36
+ property :minQualifiedCardinality
37
+ property :onClass
38
+ property :onDataRange
39
+ property :onDatatype
40
+ property :onProperties
41
+ property :onProperty
42
+ property :oneOf
43
+ property :priorVersion
44
+ property :propertyChainAxiom
45
+ property :propertyDisjointWith
46
+ property :qualifiedCardinality
47
+ property :sameAs
48
+ property :someValuesFrom
49
+ property :sourceIndividual
50
+ property :targetIndividual
51
+ property :targetValue
52
+ property :topDataProperty
53
+ property :topObjectProperty
54
+ property :unionOf
55
+ property :versionIRI
56
+ property :versionInfo
57
+ property :withRestrictions
58
+ end
59
+ end
@@ -0,0 +1,17 @@
1
+ module RDF
2
+ ##
3
+ # RDF Schema (RDFS) vocabulary.
4
+ #
5
+ # @see http://www.w3.org/TR/rdf-schema/
6
+ class RDFS < Vocabulary("http://www.w3.org/2000/01/rdf-schema#")
7
+ property :comment
8
+ property :domain
9
+ property :isDefinedBy
10
+ property :label
11
+ property :member
12
+ property :range
13
+ property :seeAlso
14
+ property :subClassOf
15
+ property :subPropertyOf
16
+ end
17
+ end
data/lib/vocabs/rsa.rb ADDED
@@ -0,0 +1,12 @@
1
+ module RDF
2
+ ##
3
+ # W3 RSA Keys (RSA) vocabulary.
4
+ #
5
+ # @see http://www.w3.org/ns/auth/rsa#
6
+ # @since 0.2.0
7
+ class RSA < Vocabulary("http://www.w3.org/ns/auth/rsa#")
8
+ property :modulus
9
+ property :private_exponent
10
+ property :public_exponent
11
+ end
12
+ end
data/lib/vocabs/rss.rb ADDED
@@ -0,0 +1,14 @@
1
+ module RDF
2
+ ##
3
+ # RDF Site Summary (RSS) vocabulary.
4
+ #
5
+ # @see http://web.resource.org/rss/1.0/
6
+ class RSS < Vocabulary("http://purl.org/rss/1.0/")
7
+ property :description
8
+ property :items
9
+ property :link
10
+ property :name
11
+ property :title
12
+ property :url
13
+ end
14
+ end
@@ -0,0 +1,93 @@
1
+ module RDF
2
+ ##
3
+ # Semantically-Interlinked Online Communities (SIOC) vocabulary.
4
+ #
5
+ # @see http://rdfs.org/sioc/spec/
6
+ class SIOC < Vocabulary("http://rdfs.org/sioc/ns#")
7
+ property :about
8
+ property :account_of
9
+ property :administrator_of
10
+ property :attachment
11
+ property :avatar
12
+ property :container_of
13
+ property :content
14
+ property :content_encoded # @deprecated
15
+ property :created_at # @deprecated
16
+ property :creator_of
17
+ property :description # @deprecated
18
+ property :earlier_version
19
+ property :email
20
+ property :email_sha1
21
+ property :feed
22
+ property :first_name # @deprecated
23
+ property :follows
24
+ property :function_of
25
+ property :group_of # @deprecated
26
+ property :has_administrator
27
+ property :has_container
28
+ property :has_creator
29
+ property :has_discussion
30
+ property :has_function
31
+ property :has_group # @deprecated
32
+ property :has_host
33
+ property :has_member
34
+ property :has_moderator
35
+ property :has_modifier
36
+ property :has_owner
37
+ property :has_parent
38
+ property :has_part # @deprecated
39
+ property :has_reply
40
+ property :has_scope
41
+ property :has_space
42
+ property :has_subscriber
43
+ property :has_usergroup
44
+ property :host_of
45
+ property :id
46
+ property :ip_address
47
+ property :last_activity_date
48
+ property :last_item_date
49
+ property :last_name # @deprecated
50
+ property :last_reply_date
51
+ property :later_version
52
+ property :latest_version
53
+ property :link
54
+ property :links_to
55
+ property :member_of
56
+ property :moderator_of
57
+ property :modified_at # @deprecated
58
+ property :modifier_of
59
+ property :name
60
+ property :next_by_date
61
+ property :next_version
62
+ property :note
63
+ property :num_authors
64
+ property :num_items
65
+ property :num_replies
66
+ property :num_threads
67
+ property :num_views
68
+ property :owner_of
69
+ property :parent_of
70
+ property :part_of # @deprecated
71
+ property :previous_by_date
72
+ property :previous_version
73
+ property :reference # @deprecated
74
+ property :related_to
75
+ property :reply_of
76
+ property :scope_of
77
+ property :sibling
78
+ property :space_of
79
+ property :subject # @deprecated
80
+ property :subscriber_of
81
+ property :title # @deprecated
82
+ property :topic
83
+ property :usergroup_of
84
+
85
+ ##
86
+ # Semantically-Interlinked Online Communities (SIOC) types vocabulary.
87
+ #
88
+ # @see http://rdfs.org/sioc/spec/#sec-modules
89
+ class Types < RDF::Vocabulary("http://rdfs.org/sioc/types#")
90
+ # TODO
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,36 @@
1
+ module RDF
2
+ ##
3
+ # Simple Knowledge Organization System (SKOS) vocabulary.
4
+ #
5
+ # @see http://www.w3.org/TR/skos-reference/skos.html
6
+ class SKOS < Vocabulary("http://www.w3.org/2004/02/skos/core#")
7
+ property :altLabel
8
+ property :broadMatch
9
+ property :broader
10
+ property :broaderTransitive
11
+ property :changeNote
12
+ property :closeMatch
13
+ property :definition
14
+ property :editorialNote
15
+ property :exactMatch
16
+ property :example
17
+ property :hasTopConcept
18
+ property :hiddenLabel
19
+ property :historyNote
20
+ property :inScheme
21
+ property :mappingRelation
22
+ property :member
23
+ property :memberList
24
+ property :narrowMatch
25
+ property :narrower
26
+ property :narrowerTransitive
27
+ property :notation
28
+ property :note
29
+ property :prefLabel
30
+ property :related
31
+ property :relatedMatch
32
+ property :scopeNote
33
+ property :semanticRelation
34
+ property :topConceptOf
35
+ end
36
+ end
data/lib/vocabs/wot.rb ADDED
@@ -0,0 +1,21 @@
1
+ module RDF
2
+ ##
3
+ # Web of Trust (WOT) vocabulary.
4
+ #
5
+ # @see http://xmlns.com/wot/0.1/
6
+ class WOT < Vocabulary("http://xmlns.com/wot/0.1/")
7
+ property :assurance
8
+ property :encryptedTo
9
+ property :encrypter
10
+ property :fingerprint
11
+ property :hasKey
12
+ property :hex_id
13
+ property :identity
14
+ property :length
15
+ property :pubkeyAddress
16
+ property :sigdate
17
+ property :signed
18
+ property :signer
19
+ property :sigtime
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ module RDF
2
+ ##
3
+ # Extensible HyperText Markup Language (XHTML) vocabulary.
4
+ #
5
+ # @see http://www.w3.org/1999/xhtml/
6
+ class XHTML < Vocabulary("http://www.w3.org/1999/xhtml#")
7
+ # TODO
8
+ end
9
+ end
data/lib/vocabs/xsd.rb ADDED
@@ -0,0 +1,58 @@
1
+ module RDF
2
+ ##
3
+ # XML Schema (XSD) vocabulary.
4
+ #
5
+ # @see http://www.w3.org/XML/Schema
6
+ # @see http://www.w3.org/TR/xmlschema-2/#built-in-datatypes
7
+ class XSD < Vocabulary("http://www.w3.org/2001/XMLSchema#")
8
+ # XML Schema built-in primitive types
9
+ # @see http://www.w3.org/TR/xmlschema-2/#built-in-primitive-datatypes
10
+ property :NOTATION
11
+ property :QName
12
+ property :anyURI
13
+ property :base64Binary
14
+ property :boolean
15
+ property :date
16
+ property :dateTime
17
+ property :decimal
18
+ property :double
19
+ property :duration
20
+ property :float
21
+ property :gDay
22
+ property :gMonth
23
+ property :gMonthDay
24
+ property :gYear
25
+ property :gYearMonth
26
+ property :hexBinary
27
+ property :string
28
+ property :time
29
+
30
+ # XML Schema built-in derived types
31
+ # @see http://www.w3.org/TR/xmlschema-2/#built-in-derived
32
+ property :ENTITIES
33
+ property :ENTITY
34
+ property :ID
35
+ property :IDREF
36
+ property :IDREFS
37
+ property :NCName
38
+ property :NMTOKEN
39
+ property :NMTOKENS
40
+ property :Name
41
+ property :byte
42
+ property :int
43
+ property :integer
44
+ property :language
45
+ property :long
46
+ property :negativeInteger
47
+ property :nonNegativeInteger
48
+ property :nonPositiveInteger
49
+ property :normalizedString
50
+ property :positiveInteger
51
+ property :short
52
+ property :token
53
+ property :unsignedByte
54
+ property :unsignedInt
55
+ property :unsignedLong
56
+ property :unsignedShort
57
+ end
58
+ end
@@ -0,0 +1,13 @@
1
+ PREFIX qb: <http://purl.org/linked-data/cube#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
4
+
5
+
6
+ SELECT DISTINCT ?dimension ?code ?codeLabel WHERE{
7
+ ?dim a qb:DimensionProperty;
8
+ rdfs:label ?dimension;
9
+ qb:codeList ?codes.
10
+
11
+ ?codes skos:hasTopConcept ?code.
12
+ ?code skos:prefLabel ?codeLabel.
13
+ }
@@ -0,0 +1,7 @@
1
+ PREFIX qb: <http://purl.org/linked-data/cube#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+
4
+ SELECT DISTINCT ?dataset ?label WHERE{
5
+ ?dataset a qb:DataSet;
6
+ rdfs:label ?label.
7
+ }
@@ -0,0 +1,8 @@
1
+ PREFIX qb: <http://purl.org/linked-data/cube#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+
4
+ SELECT DISTINCT ?dimension ?range WHERE {
5
+ ?dim a qb:DimensionProperty;
6
+ rdfs:label ?dimension;
7
+ rdfs:range ?range.
8
+ }
@@ -0,0 +1,7 @@
1
+ PREFIX qb: <http://purl.org/linked-data/cube#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+
4
+ SELECT DISTINCT ?dimension WHERE{
5
+ ?dim a qb:DimensionProperty;
6
+ rdfs:label ?dimension.
7
+ }
@@ -0,0 +1,7 @@
1
+ PREFIX qb: <http://purl.org/linked-data/cube#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+
4
+ SELECT DISTINCT ?measure WHERE{
5
+ ?meas a qb:MeasureProperty;
6
+ rdfs:label ?measure.
7
+ }
@@ -0,0 +1,12 @@
1
+ PREFIX qb: <http://purl.org/linked-data/cube#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX prop: <http://www.rqtl.org/dc/properties/>
4
+
5
+ SELECT DISTINCT ?observation ?property ?value WHERE{
6
+ ?observation a qb:Observation;
7
+ ?property ?value.
8
+
9
+ { ?property a qb:DimensionProperty. }
10
+ UNION
11
+ { ?property a qb:MeasureProperty. }
12
+ }
@@ -0,0 +1,3 @@
1
+ SELECT * WHERE{
2
+ ?s ?p ?o
3
+ }LIMIT 10
@@ -0,0 +1,23 @@
1
+ @relation weather
2
+
3
+ @attribute outlook {sunny, overcast, rainy}
4
+ @attribute temperature real
5
+ @attribute humidity real
6
+ @attribute windy {TRUE, FALSE}
7
+ @attribute play {yes, no}
8
+
9
+ @data
10
+ sunny,85,85,FALSE,no
11
+ sunny,80,90,TRUE,no
12
+ overcast,83,86,FALSE,yes
13
+ rainy,70,96,FALSE,yes
14
+ rainy,68,80,FALSE,yes
15
+ rainy,65,70,TRUE,no
16
+ overcast,64,65,TRUE,yes
17
+ sunny,72,95,FALSE,no
18
+ sunny,69,70,FALSE,yes
19
+ rainy,75,80,FALSE,yes
20
+ sunny,75,70,TRUE,yes
21
+ overcast,72,90,TRUE,yes
22
+ overcast,81,75,FALSE,yes
23
+ rainy,71,91,TRUE,no
@@ -0,0 +1,36 @@
1
+ require_relative '../lib/bio-publisci.rb'
2
+
3
+ describe R2RDF::Analyzer do
4
+ class Ana
5
+ include R2RDF::Analyzer
6
+ end
7
+
8
+ before(:all) do
9
+ @analyzer = Ana.new
10
+
11
+ @measures = ['chunkiness','deliciousness']
12
+ @dimensions = ['producer', 'pricerange']
13
+ @labels = %w(hormel newskies whys)
14
+ @data =
15
+ {
16
+ "producer" => ["hormel","newskies", "whys"],
17
+ "pricerange" => ["low", "medium", "nonexistant"],
18
+ "chunkiness"=> [1, 6, 9001],
19
+ "deliciousness"=> [1, 9, 6]
20
+ }
21
+ end
22
+
23
+ it "should run a basic validation" do
24
+ newdata = []
25
+
26
+ @data.keys.size.times{|i|
27
+ obs = {}
28
+ @data.map{|k,v|
29
+ obs[k] = v[i]
30
+ }
31
+ newdata << obs
32
+ }
33
+
34
+ @analyzer.check_integrity(newdata, @measures, @dimensions)
35
+ end
36
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "BioPublisci" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ producer,pricerange,chunkiness,deliciousness
2
+ hormel,low,1,1
3
+ newskies,medium,6,9
4
+ whys,nonexistant,9001,6
@@ -0,0 +1,11 @@
1
+ producer,pricerange,chunkiness,deliciousness
2
+ hormel,low,1,1
3
+ oscar_mayer,low,6,3
4
+ newskies,medium,2,5
5
+ hormel,low,2,2
6
+ DArtagnan,medium,6,9
7
+ oscar_mayer,low,5,4
8
+ hormel,low,2,1
9
+ farmland,high,6,9
10
+ newskies,medium,6,9
11
+ whys,nonexistant,9001,6