rdf-ldp 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0be7f489ad619cd255b25d2ac00465efd6033ddb
4
- data.tar.gz: 305116dc56d270393077cbc75a33bd0238618578
3
+ metadata.gz: f0464564fbed6e38d472a4c88c978d7cae09caa8
4
+ data.tar.gz: 6136c2d0ab782a82a280e6c935afc503a14f2b69
5
5
  SHA512:
6
- metadata.gz: 721011e7534e0a13970602eff7e2874d4b01fa9c6288b0f1d7e536aa4df853f0cdd580b5104b9ea408b278dcb3b9abdb581cb0aae5824afc4af370f0486db24b
7
- data.tar.gz: 3a4c9b0e608377c00e2d46d9d8aa61a70818714ded725bc87e8d2e80cb8d705ae381b4e256ba6f84008ec7fd89ab02c69e839a84ec905d0133922aedb5b1e5c2
6
+ metadata.gz: de8c284afa28d7be78ec5aeb9b17619bb6a7691b54117828b99bc03e6ce3dc0257a0fe8fe981d69119d283dd3e3fa40aaaa0cc843e13ee2e6396fdc89a02ea2b
7
+ data.tar.gz: 36d3c3272d8f54f7a1d0457395e408ab3260e5d5581d555b4629afec43bc5503566b031f33cfbb5f4d26de1f2b35e3901cbb56e491ffe3e07537f106b3de8472
data/.travis.yml CHANGED
@@ -1,11 +1,11 @@
1
1
  language: ruby
2
- script: rake ci
2
+ script: rake spec
3
3
  rvm:
4
4
  - 2.1.1
5
5
  # - ruby-head
6
- env:
7
- global:
8
- - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
6
+ #env:
7
+ # global:
8
+ # - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
9
9
  notifications:
10
10
  email:
11
11
  - ndushay@stanford.edu
data/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  Contains vocabularies to be used by RDF ruby gem https://github.com/ruby-rdf/rdf/ to simplify coding when using LDP data.
6
6
 
7
+ Also contains helper method to strip LDP triples from an RDF::Graph object.
8
+
7
9
  ## Installation
8
10
 
9
11
  Add this line to your application's Gemfile:
@@ -23,7 +25,7 @@ Or install it yourself as:
23
25
  ## Usage
24
26
 
25
27
  include rdf
26
- include rdf-ldp
28
+ include rdf/ldp
27
29
 
28
30
  RDF::LDP.member #=> RDF::URI("http://www.w3.org/ns/ldp#member")
29
31
 
data/Rakefile CHANGED
@@ -1,2 +1,15 @@
1
- require "bundler/gem_tasks"
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rspec/core/rake_task'
8
+
9
+ RSpec::Core::RakeTask.new(:spec)
10
+
11
+ task :rspec => :spec
12
+ task :default => :spec
13
+
14
+ Bundler::GemHelper.install_tasks
2
15
 
@@ -0,0 +1,23 @@
1
+ require 'rdf'
2
+
3
+ # mixin methods
4
+ module RDF
5
+ class LDP < RDF::StrictVocabulary("http://www.w3.org/ns/ldp")
6
+
7
+ # returns graph without any LDP-specific triples
8
+ def self.remove_ldp_triples graph
9
+ if graph && graph.is_a?(RDF::Graph) && graph.count > 0
10
+ no_ldp_graph = RDF::Graph.new
11
+ ldp_props = RDF::LDP.properties.map {|p| p.to_s}
12
+ graph.each { |stmt|
13
+ no_ldp_graph << stmt unless ldp_props.include?(stmt.predicate.to_s) ||
14
+ ldp_props.include?(stmt.object.to_s) ||
15
+ ldp_props.include?(stmt.subject.to_s)
16
+ }
17
+ no_ldp_graph
18
+ else
19
+ graph
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,5 +1 @@
1
- module RDF
2
- module LDP
3
- VERSION = "0.0.2"
4
- end
5
- end
1
+ VERSION = "0.0.3"
@@ -0,0 +1,140 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # This file generated automatically using vocab-fetch from http://www.w3.org/ns/ldp
3
+ require 'rdf'
4
+ module RDF
5
+ class LDP < RDF::StrictVocabulary("http://www.w3.org/ns/ldp")
6
+
7
+ # Class definitions
8
+ term :"#BasicContainer",
9
+ comment: %(An LDPC that uses a predefined predicate to simply link to its contained resources.).freeze,
10
+ label: "BasicContainer".freeze,
11
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
12
+ subClassOf: "http://www.w3.org/ns/ldp#Container".freeze,
13
+ type: "rdfs:Class".freeze,
14
+ "vs:term_status" => %(unstable).freeze
15
+ term :"#Container",
16
+ comment: %(A Linked Data Platform RDF Source \(LDP-RS\) that also conforms to additional patterns and conventions for managing membership. Readers should refer to the specification defining this ontology for the list of behaviors associated with it.).freeze,
17
+ label: "Container".freeze,
18
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
19
+ subClassOf: "http://www.w3.org/ns/ldp#RDFSource".freeze,
20
+ type: "rdfs:Class".freeze,
21
+ "vs:term_status" => %(unstable).freeze
22
+ term :"#DirectContainer",
23
+ comment: %(An LDPC that has the flexibility of choosing what form the membership triples take.).freeze,
24
+ label: "DirectContainer".freeze,
25
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
26
+ subClassOf: "http://www.w3.org/ns/ldp#Container".freeze,
27
+ type: "rdfs:Class".freeze,
28
+ "vs:term_status" => %(unstable).freeze
29
+ term :"#IndirectContainer",
30
+ comment: %(An LDPC that is similar to a LDP-DC but it allows an indirection with the ability to list as member a resource, such as a URI representing a real-world object, that is different from the resource that is created).freeze,
31
+ label: "IndirectContainer".freeze,
32
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
33
+ subClassOf: "http://www.w3.org/ns/ldp#Container".freeze,
34
+ type: "rdfs:Class".freeze,
35
+ "vs:term_status" => %(unstable).freeze
36
+ term :"#NonRDFSource",
37
+ comment: %(A Linked Data Platform Resource \(LDPR\) whose state is NOT represented as RDF.).freeze,
38
+ label: "NonRDFSource".freeze,
39
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
40
+ subClassOf: "http://www.w3.org/ns/ldp#Resource".freeze,
41
+ type: "rdfs:Class".freeze,
42
+ "vs:term_status" => %(unstable).freeze
43
+ term :"#RDFSource",
44
+ comment: %(A Linked Data Platform Resource \(LDPR\) whose state is represented as RDF.).freeze,
45
+ label: "RDFSource".freeze,
46
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
47
+ subClassOf: "http://www.w3.org/ns/ldp#Resource".freeze,
48
+ type: "rdfs:Class".freeze,
49
+ "vs:term_status" => %(unstable).freeze
50
+ term :"#Resource",
51
+ comment: %(A HTTP-addressable resource whose lifecycle is managed by a LDP server.).freeze,
52
+ label: "Resource".freeze,
53
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
54
+ type: "rdfs:Class".freeze,
55
+ "vs:term_status" => %(unstable).freeze
56
+
57
+ # Property definitions
58
+ property :"#contains",
59
+ comment: %(Links a container with resources created through the container.).freeze,
60
+ domain: "http://www.w3.org/ns/ldp#Container".freeze,
61
+ label: "contains".freeze,
62
+ range: "rdfs:Resource".freeze,
63
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
64
+ type: "rdf:Property".freeze,
65
+ "vs:term_status" => %(unstable).freeze
66
+ property :"#hasMemberRelation",
67
+ comment: %(Indicates which predicate is used in membership triples, and that the membership triple pattern is < membership-constant-URI , object-of-hasMemberRelation, member-URI >.).freeze,
68
+ domain: "http://www.w3.org/ns/ldp#Container".freeze,
69
+ label: "hasMemberRelation".freeze,
70
+ range: "rdf:Property".freeze,
71
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
72
+ type: "rdf:Property".freeze,
73
+ "vs:term_status" => %(unstable).freeze
74
+ property :"#insertedContentRelation",
75
+ comment: %(Indicates which triple in a creation request should be used as the member-URI value in the membership triple added when the creation request is successful.).freeze,
76
+ domain: "http://www.w3.org/ns/ldp#Container".freeze,
77
+ label: "insertedContentRelation".freeze,
78
+ range: "rdf:Property".freeze,
79
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
80
+ type: "rdf:Property".freeze,
81
+ "vs:term_status" => %(unstable).freeze
82
+ property :"#isMemberOfRelation",
83
+ comment: %(Indicates which predicate is used in membership triples, and that the membership triple pattern is < member-URI , object-of-isMemberOfRelation, membership-constant-URI >.).freeze,
84
+ domain: "http://www.w3.org/ns/ldp#Container".freeze,
85
+ label: "isMemmberOfRelation".freeze,
86
+ range: "rdf:Property".freeze,
87
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
88
+ type: "rdf:Property".freeze,
89
+ "vs:term_status" => %(unstable).freeze
90
+ property :"#member",
91
+ comment: %(LDP servers should use this predicate as the membership predicate if there is no obvious predicate from an application vocabulary to use.).freeze,
92
+ domain: "http://www.w3.org/ns/ldp#Resource".freeze,
93
+ label: "member".freeze,
94
+ range: "rdfs:Resource".freeze,
95
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
96
+ type: "rdf:Property".freeze,
97
+ "vs:term_status" => %(unstable).freeze
98
+ property :"#membershipResource",
99
+ comment: %(Indicates the membership-constant-URI in a membership triple. Depending upon the membership triple pattern a container uses, as indicated by the presence of ldp:hasMemberRelation or ldp:isMemberOfRelation, the membership-constant-URI might occupy either the subject or object position in membership triples.).freeze,
100
+ domain: "http://www.w3.org/ns/ldp#Container".freeze,
101
+ label: "membershipResource".freeze,
102
+ range: "rdf:Property".freeze,
103
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
104
+ type: "rdf:Property".freeze,
105
+ "vs:term_status" => %(unstable).freeze
106
+
107
+ # Extra definitions
108
+ term :"#",
109
+ comment: %(This ontology provides an informal representation of the concepts and terms as defined in the LDP specification. Consult the LDP specification for normative reference.).freeze,
110
+ "dc:description" => %(All vocabulary URIs defined in the Linked Data Platform \(LDP\) namespace.).freeze,
111
+ "dc:title" => %(The W3C Linked Data Platform \(LDP\) Vocabulary).freeze,
112
+ label: "W3C Linked Data Platform (LDP)".freeze,
113
+ "rdfs:seeAlso" => [%(http://www.w3.org/2012/ldp).freeze, %(http://www.w3.org/TR/ldp-ucr/).freeze, %(http://www.w3.org/TR/ldp/).freeze, %(http://www.w3.org/2011/09/LinkedData/).freeze],
114
+ type: "owl:Ontology".freeze
115
+ term :"#MemberSubject",
116
+ comment: %(Used to indicate default and typical behavior for ldp:insertedContentRelation, where the member-URI value in the membership triple added when a creation request is successful is the URI assigned to the newly created resource.).freeze,
117
+ label: "MemberSubject".freeze,
118
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
119
+ type: "rdf:Description".freeze,
120
+ "vs:term_status" => %(unstable).freeze
121
+ term :"#PreferContainment",
122
+ comment: %(URI identifying a LDPC's containment triples, for example to allow clients to express interest in receiving them.).freeze,
123
+ label: "PreferContainment".freeze,
124
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
125
+ type: "rdf:Description".freeze,
126
+ "vs:term_status" => %(unstable).freeze
127
+ term :"#PreferEmptyContainer",
128
+ comment: %(URI identifying the subset of a LDPC's triples present in an empty LDPC, for example to allow clients to express interest in receiving them. Currently this excludes containment and membership triples, but in the future other exclusions might be added. This definition is written to automatically exclude those new classes of triples.).freeze,
129
+ label: "PreferEmptyContainer".freeze,
130
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
131
+ type: "rdf:Description".freeze,
132
+ "vs:term_status" => %(unstable).freeze
133
+ term :"#PreferMembership",
134
+ comment: %(URI identifying a LDPC's membership triples, for example to allow clients to express interest in receiving them.).freeze,
135
+ label: "PreferMembership".freeze,
136
+ "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
137
+ type: "rdf:Description".freeze,
138
+ "vs:term_status" => %(unstable).freeze
139
+ end
140
+ end
data/lib/rdf/ldp.rb CHANGED
@@ -1,140 +1,2 @@
1
- # -*- encoding: utf-8 -*-
2
- # This file generated automatically using vocab-fetch from http://www.w3.org/ns/ldp
3
- require 'rdf'
4
- module RDF
5
- class LDP < RDF::StrictVocabulary("http://www.w3.org/ns/ldp")
6
-
7
- # Class definitions
8
- term :"#BasicContainer",
9
- comment: %(An LDPC that uses a predefined predicate to simply link to its contained resources.).freeze,
10
- label: "BasicContainer".freeze,
11
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
12
- subClassOf: "http://www.w3.org/ns/ldp#Container".freeze,
13
- type: "rdfs:Class".freeze,
14
- "vs:term_status" => %(unstable).freeze
15
- term :"#Container",
16
- comment: %(A Linked Data Platform RDF Source \(LDP-RS\) that also conforms to additional patterns and conventions for managing membership. Readers should refer to the specification defining this ontology for the list of behaviors associated with it.).freeze,
17
- label: "Container".freeze,
18
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
19
- subClassOf: "http://www.w3.org/ns/ldp#RDFSource".freeze,
20
- type: "rdfs:Class".freeze,
21
- "vs:term_status" => %(unstable).freeze
22
- term :"#DirectContainer",
23
- comment: %(An LDPC that has the flexibility of choosing what form the membership triples take.).freeze,
24
- label: "DirectContainer".freeze,
25
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
26
- subClassOf: "http://www.w3.org/ns/ldp#Container".freeze,
27
- type: "rdfs:Class".freeze,
28
- "vs:term_status" => %(unstable).freeze
29
- term :"#IndirectContainer",
30
- comment: %(An LDPC that is similar to a LDP-DC but it allows an indirection with the ability to list as member a resource, such as a URI representing a real-world object, that is different from the resource that is created).freeze,
31
- label: "IndirectContainer".freeze,
32
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
33
- subClassOf: "http://www.w3.org/ns/ldp#Container".freeze,
34
- type: "rdfs:Class".freeze,
35
- "vs:term_status" => %(unstable).freeze
36
- term :"#NonRDFSource",
37
- comment: %(A Linked Data Platform Resource \(LDPR\) whose state is NOT represented as RDF.).freeze,
38
- label: "NonRDFSource".freeze,
39
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
40
- subClassOf: "http://www.w3.org/ns/ldp#Resource".freeze,
41
- type: "rdfs:Class".freeze,
42
- "vs:term_status" => %(unstable).freeze
43
- term :"#RDFSource",
44
- comment: %(A Linked Data Platform Resource \(LDPR\) whose state is represented as RDF.).freeze,
45
- label: "RDFSource".freeze,
46
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
47
- subClassOf: "http://www.w3.org/ns/ldp#Resource".freeze,
48
- type: "rdfs:Class".freeze,
49
- "vs:term_status" => %(unstable).freeze
50
- term :"#Resource",
51
- comment: %(A HTTP-addressable resource whose lifecycle is managed by a LDP server.).freeze,
52
- label: "Resource".freeze,
53
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
54
- type: "rdfs:Class".freeze,
55
- "vs:term_status" => %(unstable).freeze
56
-
57
- # Property definitions
58
- property :"#contains",
59
- comment: %(Links a container with resources created through the container.).freeze,
60
- domain: "http://www.w3.org/ns/ldp#Container".freeze,
61
- label: "contains".freeze,
62
- range: "rdfs:Resource".freeze,
63
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
64
- type: "rdf:Property".freeze,
65
- "vs:term_status" => %(unstable).freeze
66
- property :"#hasMemberRelation",
67
- comment: %(Indicates which predicate is used in membership triples, and that the membership triple pattern is < membership-constant-URI , object-of-hasMemberRelation, member-URI >.).freeze,
68
- domain: "http://www.w3.org/ns/ldp#Container".freeze,
69
- label: "hasMemberRelation".freeze,
70
- range: "rdf:Property".freeze,
71
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
72
- type: "rdf:Property".freeze,
73
- "vs:term_status" => %(unstable).freeze
74
- property :"#insertedContentRelation",
75
- comment: %(Indicates which triple in a creation request should be used as the member-URI value in the membership triple added when the creation request is successful.).freeze,
76
- domain: "http://www.w3.org/ns/ldp#Container".freeze,
77
- label: "insertedContentRelation".freeze,
78
- range: "rdf:Property".freeze,
79
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
80
- type: "rdf:Property".freeze,
81
- "vs:term_status" => %(unstable).freeze
82
- property :"#isMemberOfRelation",
83
- comment: %(Indicates which predicate is used in membership triples, and that the membership triple pattern is < member-URI , object-of-isMemberOfRelation, membership-constant-URI >.).freeze,
84
- domain: "http://www.w3.org/ns/ldp#Container".freeze,
85
- label: "isMemmberOfRelation".freeze,
86
- range: "rdf:Property".freeze,
87
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
88
- type: "rdf:Property".freeze,
89
- "vs:term_status" => %(unstable).freeze
90
- property :"#member",
91
- comment: %(LDP servers should use this predicate as the membership predicate if there is no obvious predicate from an application vocabulary to use.).freeze,
92
- domain: "http://www.w3.org/ns/ldp#Resource".freeze,
93
- label: "member".freeze,
94
- range: "rdfs:Resource".freeze,
95
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
96
- type: "rdf:Property".freeze,
97
- "vs:term_status" => %(unstable).freeze
98
- property :"#membershipResource",
99
- comment: %(Indicates the membership-constant-URI in a membership triple. Depending upon the membership triple pattern a container uses, as indicated by the presence of ldp:hasMemberRelation or ldp:isMemberOfRelation, the membership-constant-URI might occupy either the subject or object position in membership triples.).freeze,
100
- domain: "http://www.w3.org/ns/ldp#Container".freeze,
101
- label: "membershipResource".freeze,
102
- range: "rdf:Property".freeze,
103
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
104
- type: "rdf:Property".freeze,
105
- "vs:term_status" => %(unstable).freeze
106
-
107
- # Extra definitions
108
- term :"#",
109
- comment: %(This ontology provides an informal representation of the concepts and terms as defined in the LDP specification. Consult the LDP specification for normative reference.).freeze,
110
- "dc:description" => %(All vocabulary URIs defined in the Linked Data Platform \(LDP\) namespace.).freeze,
111
- "dc:title" => %(The W3C Linked Data Platform \(LDP\) Vocabulary).freeze,
112
- label: "W3C Linked Data Platform (LDP)".freeze,
113
- "rdfs:seeAlso" => [%(http://www.w3.org/2012/ldp).freeze, %(http://www.w3.org/TR/ldp-ucr/).freeze, %(http://www.w3.org/TR/ldp/).freeze, %(http://www.w3.org/2011/09/LinkedData/).freeze],
114
- type: "owl:Ontology".freeze
115
- term :"#MemberSubject",
116
- comment: %(Used to indicate default and typical behavior for ldp:insertedContentRelation, where the member-URI value in the membership triple added when a creation request is successful is the URI assigned to the newly created resource.).freeze,
117
- label: "MemberSubject".freeze,
118
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
119
- type: "rdf:Description".freeze,
120
- "vs:term_status" => %(unstable).freeze
121
- term :"#PreferContainment",
122
- comment: %(URI identifying a LDPC's containment triples, for example to allow clients to express interest in receiving them.).freeze,
123
- label: "PreferContainment".freeze,
124
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
125
- type: "rdf:Description".freeze,
126
- "vs:term_status" => %(unstable).freeze
127
- term :"#PreferEmptyContainer",
128
- comment: %(URI identifying the subset of a LDPC's triples present in an empty LDPC, for example to allow clients to express interest in receiving them. Currently this excludes containment and membership triples, but in the future other exclusions might be added. This definition is written to automatically exclude those new classes of triples.).freeze,
129
- label: "PreferEmptyContainer".freeze,
130
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
131
- type: "rdf:Description".freeze,
132
- "vs:term_status" => %(unstable).freeze
133
- term :"#PreferMembership",
134
- comment: %(URI identifying a LDPC's membership triples, for example to allow clients to express interest in receiving them.).freeze,
135
- label: "PreferMembership".freeze,
136
- "rdfs:isDefinedBy" => %(http://www.w3.org/ns/ldp#).freeze,
137
- type: "rdf:Description".freeze,
138
- "vs:term_status" => %(unstable).freeze
139
- end
140
- end
1
+ require 'rdf/ldp/vocab'
2
+ require 'rdf/ldp/helper'
data/rdf-ldp.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'rdf/ldp/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "rdf-ldp"
8
- spec.version = RDF::LDP::VERSION
8
+ spec.version = VERSION
9
9
  spec.authors = ["Naomi Dushay"]
10
10
  spec.email = ["ndushay@stanford.edu"]
11
11
  spec.summary = %q{Linked Data Platform vocabulary for RDF.rb and helper methods}
@@ -21,4 +21,6 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.6"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ spec.add_development_dependency "rdf-turtle" # used to load testing fixtures
24
26
  end
@@ -0,0 +1,29 @@
1
+
2
+ <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb/fcr:export?format=jcr/xml> <http://purl.org/dc/elements/1.1/format> <http://fedora.info/definitions/v4/repository#jcr/xml> .
3
+
4
+ <http://fedora.info/definitions/v4/repository#jcr/xml> <http://www.w3.org/2000/01/rdf-schema#label> "jcr/xml"^^<http://www.w3.org/2001/XMLSchema#string> .
5
+
6
+ <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb> <http://fedora.info/definitions/v4/rest-api#exportsAs> <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb/fcr:export?format=jcr/xml> ;
7
+ <http://www.w3.org/ns/ldp#membershipResource> <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb> ;
8
+ <http://www.w3.org/ns/ldp#hasMemberRelation> <http://www.w3.org/ns/ldp#member> ;
9
+ a <http://www.w3.org/ns/ldp#Container> , <http://www.w3.org/ns/ldp#DirectContainer> ;
10
+ <http://www.w3.org/ns/ldp#member> <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb/b> , <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb/t> ;
11
+ <http://www.w3.org/ns/oa#hasBody> <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb/b/e14b93b7-3a88-4eb5-9688-7dea7f482d23> ;
12
+ <http://www.w3.org/ns/oa#hasTarget> <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb/t/ee774031-74d9-4f5a-9b03-cdd21267e4e1> ;
13
+ <http://www.w3.org/ns/ldp#contains> <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb/b> , <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb/t> ;
14
+ <http://fedora.info/definitions/v4/repository#hasParent> <http://localhost:8080/rest/anno> .
15
+
16
+ <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb/b> <http://www.w3.org/ns/ldp#membershipResource> <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb> .
17
+
18
+ <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb/t> <http://www.w3.org/ns/ldp#membershipResource> <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb> .
19
+
20
+ <http://localhost:8080/rest/anno/deb27887-1241-4ccc-a09c-439293d73fbb> a <http://www.jcp.org/jcr/nt/1.0folder> , <http://www.jcp.org/jcr/nt/1.0hierarchyNode> , <http://www.jcp.org/jcr/nt/1.0base> , <http://www.jcp.org/jcr/mix/1.0created> , <http://fedora.info/definitions/v4/rest-api#resource> , <http://fedora.info/definitions/v4/rest-api#object> , <http://www.w3.org/ns/oa#Annotation> , <http://fedora.info/definitions/v4/rest-api#relations> , <http://www.jcp.org/jcr/mix/1.0created> , <http://www.jcp.org/jcr/mix/1.0lastModified> , <http://www.jcp.org/jcr/mix/1.0lockable> , <http://www.jcp.org/jcr/mix/1.0referenceable> , <http://purl.org/dc/elements/1.1/describable> , <http://fedora.info/definitions/v4/rest-api#resource> , <http://www.w3.org/ns/ldp#Container> ;
21
+ <http://fedora.info/definitions/v4/rest-api#writable> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> ;
22
+ <http://fedora.info/definitions/v4/repository#primaryType> "nt:folder"^^<http://www.w3.org/2001/XMLSchema#string> ;
23
+ <http://www.w3.org/ns/oa#motivatedBy> <http://www.w3.org/ns/oa#commenting> ;
24
+ <http://fedora.info/definitions/v4/repository#created> "2014-10-13T18:33:39.191Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
25
+ <http://fedora.info/definitions/v4/repository#lastModified> "2014-10-13T18:33:39.265Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
26
+ <http://fedora.info/definitions/v4/repository#mixinTypes> "fedora:resource"^^<http://www.w3.org/2001/XMLSchema#string> , "fedora:object"^^<http://www.w3.org/2001/XMLSchema#string> , "oa:Annotation"^^<http://www.w3.org/2001/XMLSchema#string> ;
27
+ <http://fedora.info/definitions/v4/repository#lastModifiedBy> "bypassAdmin"^^<http://www.w3.org/2001/XMLSchema#string> ;
28
+ <http://fedora.info/definitions/v4/repository#uuid> "88694f22-640b-4006-97cd-5135690987cc"^^<http://www.w3.org/2001/XMLSchema#string> ;
29
+ <http://fedora.info/definitions/v4/repository#createdBy> "bypassAdmin"^^<http://www.w3.org/2001/XMLSchema#string> .
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+ require 'rdf/turtle'
3
+
4
+ describe RDF::LDP do
5
+
6
+ let(:anno_ttl) { File.read(fixture_path + '/open_anno_ldp_container.ttl') }
7
+
8
+ describe '#remove_ldp_triples' do
9
+ it 'graph returned has no ldp triples' do
10
+ graph = RDF::Graph.new
11
+ graph.from_ttl anno_ttl
12
+ expect(graph.count).to eql 39
13
+ result = graph.query [nil, RDF.type, RDF::URI.new("http://www.w3.org/ns/ldp#Container")]
14
+ expect(result.size).to eql 1
15
+ result = graph.query [nil, RDF::URI.new("http://www.w3.org/ns/ldp#contains"), nil]
16
+ expect(result.size).to eql 2
17
+
18
+ stripped_graph = RDF::LDP.remove_ldp_triples graph
19
+ expect(graph.count).to eql 39
20
+ result = stripped_graph.query [nil, RDF.type, RDF::URI.new("http://www.w3.org/ns/ldp#Container")]
21
+ expect(result.size).to eql 0
22
+ result = stripped_graph.query [nil, RDF::URI.new("http://www.w3.org/ns/ldp#contains"), nil]
23
+ expect(result.size).to eql 0
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,97 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, consider making
10
+ # a separate helper file that requires the additional dependencies and performs
11
+ # the additional setup, and require it from the spec files that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+
18
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
19
+ require 'rdf/ldp'
20
+
21
+ RSpec.configure do |config|
22
+ # rspec-expectations config goes here. You can use an alternate
23
+ # assertion/expectation library such as wrong or the stdlib/minitest
24
+ # assertions if you prefer.
25
+ config.expect_with :rspec do |expectations|
26
+ # This option will default to `true` in RSpec 4. It makes the `description`
27
+ # and `failure_message` of custom matchers include text for helper methods
28
+ # defined using `chain`, e.g.:
29
+ # be_bigger_than(2).and_smaller_than(4).description
30
+ # # => "be bigger than 2 and smaller than 4"
31
+ # ...rather than:
32
+ # # => "be bigger than 2"
33
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
+ end
35
+
36
+ # rspec-mocks config goes here. You can use an alternate test double
37
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
38
+ config.mock_with :rspec do |mocks|
39
+ # Prevents you from mocking or stubbing a method that does not exist on
40
+ # a real object. This is generally recommended, and will default to
41
+ # `true` in RSpec 4.
42
+ mocks.verify_partial_doubles = true
43
+ end
44
+
45
+ # The settings below are suggested to provide a good initial experience
46
+ # with RSpec, but feel free to customize to your heart's content.
47
+ =begin
48
+ # These two settings work together to allow you to limit a spec run
49
+ # to individual examples or groups you care about by tagging them with
50
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
51
+ # get run.
52
+ config.filter_run :focus
53
+ config.run_all_when_everything_filtered = true
54
+
55
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
56
+ # For more details, see:
57
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
58
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
59
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
60
+ config.disable_monkey_patching!
61
+
62
+ # This setting enables warnings. It's recommended, but in some cases may
63
+ # be too noisy due to issues in dependencies.
64
+ config.warnings = true
65
+
66
+ # Many RSpec users commonly either run the entire suite or an individual
67
+ # file, and it's useful to allow more verbose output when running an
68
+ # individual spec file.
69
+ if config.files_to_run.one?
70
+ # Use the documentation formatter for detailed output,
71
+ # unless a formatter has already been configured
72
+ # (e.g. via a command-line flag).
73
+ config.default_formatter = 'doc'
74
+ end
75
+
76
+ # Print the 10 slowest examples and example groups at the
77
+ # end of the spec run, to help surface which specs are running
78
+ # particularly slow.
79
+ config.profile_examples = 10
80
+
81
+ # Run specs in random order to surface order dependencies. If you find an
82
+ # order dependency and want to debug it, you can fix the order by providing
83
+ # the seed, which is printed after each run.
84
+ # --seed 1234
85
+ config.order = :random
86
+
87
+ # Seed global randomization in this process using the `--seed` CLI option.
88
+ # Setting this allows you to use `--seed` to deterministically reproduce
89
+ # test failures related to randomization by passing the same `--seed` value
90
+ # as the one that triggered the failure.
91
+ Kernel.srand config.seed
92
+ =end
93
+ end
94
+
95
+ def fixture_path path=nil
96
+ File.expand_path(File.dirname(__FILE__) + "/fixtures/#{path}")
97
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-ldp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naomi Dushay
@@ -14,44 +14,72 @@ dependencies:
14
14
  name: rdf
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.6'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdf-turtle
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  description:
56
84
  email:
57
85
  - ndushay@stanford.edu
@@ -59,15 +87,20 @@ executables: []
59
87
  extensions: []
60
88
  extra_rdoc_files: []
61
89
  files:
62
- - .gitignore
63
- - .travis.yml
90
+ - ".gitignore"
91
+ - ".travis.yml"
64
92
  - Gemfile
65
93
  - LICENSE
66
94
  - README.md
67
95
  - Rakefile
68
96
  - lib/rdf/ldp.rb
97
+ - lib/rdf/ldp/helper.rb
69
98
  - lib/rdf/ldp/version.rb
99
+ - lib/rdf/ldp/vocab.rb
70
100
  - rdf-ldp.gemspec
101
+ - spec/fixtures/open_anno_ldp_container.ttl
102
+ - spec/helper_spec.rb
103
+ - spec/spec_helper.rb
71
104
  homepage: ''
72
105
  licenses:
73
106
  - Apache 2
@@ -78,12 +111,12 @@ require_paths:
78
111
  - lib
79
112
  required_ruby_version: !ruby/object:Gem::Requirement
80
113
  requirements:
81
- - - '>='
114
+ - - ">="
82
115
  - !ruby/object:Gem::Version
83
116
  version: '0'
84
117
  required_rubygems_version: !ruby/object:Gem::Requirement
85
118
  requirements:
86
- - - '>='
119
+ - - ">="
87
120
  - !ruby/object:Gem::Version
88
121
  version: '0'
89
122
  requirements: []
@@ -92,4 +125,7 @@ rubygems_version: 2.2.0
92
125
  signing_key:
93
126
  specification_version: 4
94
127
  summary: Linked Data Platform vocabulary for RDF.rb and helper methods
95
- test_files: []
128
+ test_files:
129
+ - spec/fixtures/open_anno_ldp_container.ttl
130
+ - spec/helper_spec.rb
131
+ - spec/spec_helper.rb