rdf-fcrepo4 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rdf/fcrepo4/helper.rb +4 -1
- data/lib/rdf/fcrepo4/version.rb +1 -1
- data/spec/fixtures/anno_body_ldp_container.ttl +48 -0
- data/spec/helper_spec.rb +29 -27
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef8de0378de085ddc701f50d21f5201abb62b334
|
4
|
+
data.tar.gz: 7c8392220fa00563aca40ef515f408fd700ad7cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2ebd0b8edcdd20f3ce429af3c51c4ed16896aeec4db3e9a0c79daa7b1bc345cd38acb8ace9dcdb0b175d48a2f8e004bce87febcbe7fde1159ceedcc5f7499c7
|
7
|
+
data.tar.gz: 5c4184fa1776616f0476f6b21f944ad0cc040676b773d1c6f21149f5b1c85eec32c764a13eb27b881e1a12f44da69ec270bb47bb30981cb957728dd321a9b06d
|
data/lib/rdf/fcrepo4/helper.rb
CHANGED
@@ -12,6 +12,8 @@ module RDF
|
|
12
12
|
# the fedora vocab is not complete and also doesn't cover modeshape triples
|
13
13
|
fedora_ns = "http://fedora.info/definitions"
|
14
14
|
modeshape_ns = "http://www.jcp.org/jcr"
|
15
|
+
# this is the old way, but just in case ...
|
16
|
+
fedora_describable = "http://purl.org/dc/elements/1.1/describable"
|
15
17
|
graph.each { |stmt|
|
16
18
|
no_fedora_graph << stmt unless fedora_props.include?(stmt.predicate.to_s) ||
|
17
19
|
fedora_props.include?(stmt.object.to_s) ||
|
@@ -20,7 +22,8 @@ module RDF
|
|
20
22
|
stmt.predicate.to_s.match(modeshape_ns) ||
|
21
23
|
stmt.subject.to_s.match(fedora_ns) ||
|
22
24
|
stmt.object.to_s.match(fedora_ns) ||
|
23
|
-
stmt.object.to_s.match(modeshape_ns)
|
25
|
+
stmt.object.to_s.match(modeshape_ns) ||
|
26
|
+
stmt.object.to_s == (fedora_describable)
|
24
27
|
}
|
25
28
|
no_fedora_graph
|
26
29
|
else
|
data/lib/rdf/fcrepo4/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION = "0.0.
|
1
|
+
VERSION = "0.0.6"
|
@@ -0,0 +1,48 @@
|
|
1
|
+
@prefix dc: <http://purl.org/dc/elements/1.1/> .
|
2
|
+
@prefix nt: <http://www.jcp.org/jcr/nt/1.0> .
|
3
|
+
@prefix openannotation: <http://www.w3.org/ns/oa#> .
|
4
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
5
|
+
@prefix fcrepo: <http://fedora.info/definitions/v4/repository#> .
|
6
|
+
@prefix test: <info:fedora/test/> .
|
7
|
+
@prefix fedoraconfig: <http://fedora.info/definitions/v4/config#> .
|
8
|
+
@prefix dcmitype: <http://purl.org/dc/dcmitype/> .
|
9
|
+
@prefix image: <http://www.modeshape.org/images/1.0> .
|
10
|
+
@prefix xs: <http://www.w3.org/2001/XMLSchema> .
|
11
|
+
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
|
12
|
+
@prefix fedorarelsext: <http://fedora.info/definitions/v4/rels-ext#> .
|
13
|
+
@prefix mix: <http://www.jcp.org/jcr/mix/1.0> .
|
14
|
+
@prefix premis: <http://www.loc.gov/premis/rdf/v1#> .
|
15
|
+
@prefix mode: <http://www.modeshape.org/1.0> .
|
16
|
+
@prefix content: <http://www.w3.org/2011/content#> .
|
17
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
18
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
19
|
+
@prefix sv: <http://www.jcp.org/jcr/sv/1.0> .
|
20
|
+
@prefix triannon: <http://triannon.stanford.edu/ns/> .
|
21
|
+
@prefix xsi: <http://www.w3.org/2001/XMLSchema-instance> .
|
22
|
+
@prefix fedora: <http://fedora.info/definitions/v4/rest-api#> .
|
23
|
+
@prefix ldp: <http://www.w3.org/ns/ldp#> .
|
24
|
+
|
25
|
+
|
26
|
+
<http://localhost:8983/fedora/rest/anno/c0595c0d-e3b8-460a-a1d0-b17e885d1c68/b/a5db6574-a1d3-4bd3-bc2a-8da44013bd8d> ldp:membershipResource <http://localhost:8983/fedora/rest/anno/c0595c0d-e3b8-460a-a1d0-b17e885d1c68/b/a5db6574-a1d3-4bd3-bc2a-8da44013bd8d> ;
|
27
|
+
ldp:hasMemberRelation ldp:member ;
|
28
|
+
a ldp:Container , ldp:DirectContainer , ldp:RDFSource ;
|
29
|
+
fcrepo:hasParent <http://localhost:8983/fedora/rest/anno/c0595c0d-e3b8-460a-a1d0-b17e885d1c68/b> ;
|
30
|
+
fedora:writable "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
|
31
|
+
|
32
|
+
<http://localhost:8983/fedora/rest/anno/c0595c0d-e3b8-460a-a1d0-b17e885d1c68/b/a5db6574-a1d3-4bd3-bc2a-8da44013bd8d/fcr:export?format=jcr/xml> dc:format <http://fedora.info/definitions/v4/repository#jcr/xml> .
|
33
|
+
|
34
|
+
<http://localhost:8983/fedora/rest/anno/c0595c0d-e3b8-460a-a1d0-b17e885d1c68/b/a5db6574-a1d3-4bd3-bc2a-8da44013bd8d> fedora:exportsAs <http://localhost:8983/fedora/rest/anno/c0595c0d-e3b8-460a-a1d0-b17e885d1c68/b/a5db6574-a1d3-4bd3-bc2a-8da44013bd8d/fcr:export?format=jcr/xml> .
|
35
|
+
|
36
|
+
<http://fedora.info/definitions/v4/repository#jcr/xml> rdfs:label "jcr/xml"^^<http://www.w3.org/2001/XMLSchema#string> .
|
37
|
+
|
38
|
+
<http://localhost:8983/fedora/rest/anno/c0595c0d-e3b8-460a-a1d0-b17e885d1c68/b/a5db6574-a1d3-4bd3-bc2a-8da44013bd8d> 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> , fedora:resource , dcmitype:Text , fedora:object , content:ContentAsText , fedora:relations , <http://www.jcp.org/jcr/mix/1.0created> , <http://www.jcp.org/jcr/mix/1.0lastModified> , <http://www.jcp.org/jcr/mix/1.0referenceable> , fedora:DublinCoreDescribable , fedora:resource , ldp:Container ;
|
39
|
+
fcrepo:primaryType "nt:folder"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
40
|
+
content:chars "I love this!"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
41
|
+
dc:format "text/plain"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
42
|
+
fcrepo:created "2014-10-30T21:39:48.705Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
|
43
|
+
fcrepo:lastModified "2014-10-30T21:39:48.705Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
|
44
|
+
fcrepo:mixinTypes "fedora:resource"^^<http://www.w3.org/2001/XMLSchema#string> , "dcmitype:Text"^^<http://www.w3.org/2001/XMLSchema#string> , "fedora:object"^^<http://www.w3.org/2001/XMLSchema#string> , "content:ContentAsText"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
45
|
+
dc:language "en"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
46
|
+
fcrepo:lastModifiedBy "bypassAdmin"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
47
|
+
fcrepo:uuid "f0b878d2-ab0b-4585-ae05-da8b6b3ecc8f"^^<http://www.w3.org/2001/XMLSchema#string> ;
|
48
|
+
fcrepo:createdBy "bypassAdmin"^^<http://www.w3.org/2001/XMLSchema#string> .
|
data/spec/helper_spec.rb
CHANGED
@@ -7,36 +7,38 @@ describe RDF::FCRepo4 do
|
|
7
7
|
|
8
8
|
describe '#remove_fedora_triples' do
|
9
9
|
it 'graph returned has no fedora triples' do
|
10
|
-
graph = RDF::Graph.new
|
11
|
-
graph.from_ttl anno_ttl
|
10
|
+
graph = RDF::Graph.new.from_ttl anno_ttl
|
12
11
|
expect(graph.size).to eql 39
|
13
|
-
|
14
|
-
expect(
|
15
|
-
|
16
|
-
expect(
|
17
|
-
|
18
|
-
expect(
|
19
|
-
result = graph.query [nil, RDF::URI.new("http://fedora.info/definitions/v4/rest-api#writable"), nil]
|
20
|
-
expect(result.size).to eql 1
|
21
|
-
result = graph.query [RDF::URI.new("http://fedora.info/definitions/v4/repository#jcr/xml"), nil, nil]
|
22
|
-
expect(result.size).to eql 1
|
23
|
-
result = graph.query [nil, nil, RDF::URI.new("http://fedora.info/definitions/v4/repository#jcr/xml")]
|
24
|
-
expect(result.size).to eql 1
|
12
|
+
expect(graph.query([nil, RDF.type, RDF::URI.new("http://fedora.info/definitions/v4/rest-api#resource")]).size).to eql 1
|
13
|
+
expect(graph.query([nil, RDF.type, RDF::URI.new("http://www.jcp.org/jcr/nt/1.0base")]).size).to eql 1
|
14
|
+
expect(graph.query([nil, RDF::URI.new("http://fedora.info/definitions/v4/repository#lastModifiedBy"), nil]).size).to eql 1
|
15
|
+
expect(graph.query([nil, RDF::URI.new("http://fedora.info/definitions/v4/rest-api#writable"), nil]).size).to eql 1
|
16
|
+
expect(graph.query([RDF::URI.new("http://fedora.info/definitions/v4/repository#jcr/xml"), nil, nil]).size).to eql 1
|
17
|
+
expect(graph.query([nil, nil, RDF::URI.new("http://fedora.info/definitions/v4/repository#jcr/xml")]).size).to eql 1
|
25
18
|
|
26
19
|
stripped_graph = RDF::FCRepo4.remove_fedora_triples graph
|
27
|
-
expect(stripped_graph.size).to eql
|
28
|
-
|
29
|
-
expect(
|
30
|
-
|
31
|
-
expect(
|
32
|
-
|
33
|
-
expect(
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
20
|
+
expect(stripped_graph.size).to eql 14
|
21
|
+
expect(stripped_graph.query([nil, RDF.type, RDF::URI.new("http://fedora.info/definitions/v4/rest-api#resource")]).size).to eql 0
|
22
|
+
expect(stripped_graph.query([nil, RDF.type, RDF::URI.new("http://www.jcp.org/jcr/nt/1.0base")]).size).to eql 0
|
23
|
+
expect(stripped_graph.query([nil, RDF::URI.new("http://fedora.info/definitions/v4/repository#lastModifiedBy"), nil]).size).to eql 0
|
24
|
+
expect(stripped_graph.query([nil, RDF::URI.new("http://fedora.info/definitions/v4/rest-api#writable"), nil]).size).to eql 0
|
25
|
+
expect(stripped_graph.query([RDF::URI.new("http://fedora.info/definitions/v4/repository#jcr/xml"), nil, nil]).size).to eql 0
|
26
|
+
expect(stripped_graph.query([nil, nil, RDF::URI.new("http://fedora.info/definitions/v4/repository#jcr/xml")]).size).to eql 0
|
27
|
+
end
|
28
|
+
|
29
|
+
it "graph returned doesn't have type http://purl.org/dc/elements/1.1/describable" do
|
30
|
+
g = RDF::Graph.new.from_ttl(anno_ttl)
|
31
|
+
expect(g.query([nil, RDF.type, RDF::URI.new("http://purl.org/dc/elements/1.1/describable")]).size).to eql 1
|
32
|
+
stripped_graph = RDF::FCRepo4.remove_fedora_triples g
|
33
|
+
expect(stripped_graph.query([nil, RDF.type, RDF::URI.new("http://purl.org/dc/elements/1.1/describable")]).size).to eql 0
|
34
|
+
end
|
35
|
+
|
36
|
+
it "graph returned doesn't have type http://fedora.info/definitions/v4/rest-api#DublinCoreDescribable" do
|
37
|
+
ldp_cont_ttl = File.read(fixture_path + '/anno_body_ldp_container.ttl')
|
38
|
+
g = RDF::Graph.new.from_ttl(ldp_cont_ttl)
|
39
|
+
expect(g.query([nil, RDF.type, RDF::URI.new("http://fedora.info/definitions/v4/rest-api#DublinCoreDescribable")]).size).to eql 1
|
40
|
+
stripped_graph = RDF::FCRepo4.remove_fedora_triples g
|
41
|
+
expect(stripped_graph.query([nil, RDF.type, RDF::URI.new("http://fedora.info/definitions/v4/rest-api#DublinCoreDescribable")]).size).to eql 0
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-fcrepo4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naomi Dushay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/rdf/fcrepo4/version.rb
|
100
100
|
- lib/rdf/fcrepo4/vocab.rb
|
101
101
|
- rdf-fcrepo4.gemspec
|
102
|
+
- spec/fixtures/anno_body_ldp_container.ttl
|
102
103
|
- spec/fixtures/open_anno_ldp_container.ttl
|
103
104
|
- spec/helper_spec.rb
|
104
105
|
- spec/spec_helper.rb
|
@@ -127,6 +128,7 @@ signing_key:
|
|
127
128
|
specification_version: 4
|
128
129
|
summary: Fedora Commons Repository Version 4 vocabulary for RDF.rb and helper methods
|
129
130
|
test_files:
|
131
|
+
- spec/fixtures/anno_body_ldp_container.ttl
|
130
132
|
- spec/fixtures/open_anno_ldp_container.ttl
|
131
133
|
- spec/helper_spec.rb
|
132
134
|
- spec/spec_helper.rb
|