json-ld 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.markdown +3 -0
- data/VERSION +1 -1
- data/bin/jsonld +134 -0
- data/lib/json/ld/api.rb +4 -4
- data/lib/json/ld/frame.rb +2 -1
- data/lib/json/ld/from_rdf.rb +1 -1
- data/spec/api_spec.rb +66 -0
- data/spec/compact_spec.rb +420 -0
- data/spec/evaluation_context_spec.rb +1039 -0
- data/spec/expand_spec.rb +625 -0
- data/spec/format_spec.rb +71 -0
- data/spec/frame_spec.rb +542 -0
- data/spec/from_rdf_spec.rb +316 -0
- data/spec/matchers.rb +67 -0
- data/spec/reader_spec.rb +79 -0
- data/spec/spec_helper.rb +56 -0
- data/spec/suite_helper.rb +184 -0
- data/spec/suite_spec.rb +104 -0
- data/spec/support/extensions.rb +10 -0
- data/spec/test-files/test-1-automatic.json +10 -0
- data/spec/test-files/test-1-compacted.json +10 -0
- data/spec/test-files/test-1-context.json +7 -0
- data/spec/test-files/test-1-expanded.json +5 -0
- data/spec/test-files/test-1-input.json +10 -0
- data/spec/test-files/test-1-normalized.json +8 -0
- data/spec/test-files/test-1-rdf.ttl +7 -0
- data/spec/test-files/test-2-automatic.json +27 -0
- data/spec/test-files/test-2-compacted.json +20 -0
- data/spec/test-files/test-2-context.json +7 -0
- data/spec/test-files/test-2-expanded.json +16 -0
- data/spec/test-files/test-2-input.json +20 -0
- data/spec/test-files/test-2-normalized.json +32 -0
- data/spec/test-files/test-2-rdf.ttl +14 -0
- data/spec/test-files/test-3-compacted.json +11 -0
- data/spec/test-files/test-3-context.json +8 -0
- data/spec/test-files/test-3-expanded.json +10 -0
- data/spec/test-files/test-3-input.json +11 -0
- data/spec/test-files/test-3-normalized.json +13 -0
- data/spec/test-files/test-3-rdf.ttl +7 -0
- data/spec/test-files/test-4-automatic.json +10 -0
- data/spec/test-files/test-4-compacted.json +10 -0
- data/spec/test-files/test-4-context.json +7 -0
- data/spec/test-files/test-4-expanded.json +6 -0
- data/spec/test-files/test-4-input.json +10 -0
- data/spec/test-files/test-4-rdf.ttl +5 -0
- data/spec/test-files/test-5-automatic.json +13 -0
- data/spec/test-files/test-5-compacted.json +13 -0
- data/spec/test-files/test-5-context.json +7 -0
- data/spec/test-files/test-5-expanded.json +9 -0
- data/spec/test-files/test-5-input.json +13 -0
- data/spec/test-files/test-5-rdf.ttl +6 -0
- data/spec/test-files/test-6-automatic.json +10 -0
- data/spec/test-files/test-6-compacted.json +10 -0
- data/spec/test-files/test-6-context.json +7 -0
- data/spec/test-files/test-6-expanded.json +10 -0
- data/spec/test-files/test-6-input.json +10 -0
- data/spec/test-files/test-6-rdf.ttl +5 -0
- data/spec/test-files/test-7-automatic.json +20 -0
- data/spec/test-files/test-7-compacted.json +23 -0
- data/spec/test-files/test-7-context.json +4 -0
- data/spec/test-files/test-7-expanded.json +20 -0
- data/spec/test-files/test-7-input.json +23 -0
- data/spec/test-files/test-7-rdf.ttl +13 -0
- data/spec/test-files/test-8-automatic.json +1 -0
- data/spec/test-files/test-8-compacted.json +34 -0
- data/spec/test-files/test-8-context.json +11 -0
- data/spec/test-files/test-8-expanded.json +24 -0
- data/spec/test-files/test-8-frame.json +18 -0
- data/spec/test-files/test-8-framed.json +29 -0
- data/spec/test-files/test-8-input.json +30 -0
- data/spec/test-files/test-8-rdf.ttl +15 -0
- data/spec/test-files/test-9-compacted.json +20 -0
- data/spec/test-files/test-9-context.json +13 -0
- data/spec/test-files/test-9-expanded.json +14 -0
- data/spec/test-files/test-9-input.json +12 -0
- data/spec/to_rdf_spec.rb +640 -0
- data/spec/writer_spec.rb +161 -0
- metadata +150 -22
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"@context": {
|
3
|
+
"dc": "http://purl.org/dc/elements/1.1/",
|
4
|
+
"ex": "http://example.org/vocab#"
|
5
|
+
},
|
6
|
+
"@id": "http://example.org/library",
|
7
|
+
"@type": "ex:Library",
|
8
|
+
"ex:contains": {
|
9
|
+
"@id": "http://example.org/library/the-republic",
|
10
|
+
"@type": "ex:Book",
|
11
|
+
"dc:creator": "Plato",
|
12
|
+
"dc:title": "The Republic",
|
13
|
+
"ex:contains": {
|
14
|
+
"@id": "http://example.org/library/the-republic#introduction",
|
15
|
+
"@type": "ex:Chapter",
|
16
|
+
"dc:description": "An introductory chapter on The Republic.",
|
17
|
+
"dc:title": "The Introduction"
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
[{
|
2
|
+
"@id": "http://example.org/library",
|
3
|
+
"@type": ["http://example.org/vocab#Library"],
|
4
|
+
"http://example.org/vocab#contains": [{
|
5
|
+
"@id": "http://example.org/library/the-republic",
|
6
|
+
"@type": ["http://example.org/vocab#Book"],
|
7
|
+
"http://purl.org/dc/elements/1.1/creator": [{"@value": "Plato"}],
|
8
|
+
"http://purl.org/dc/elements/1.1/title": [{"@value": "The Republic"}],
|
9
|
+
"http://example.org/vocab#contains": [{
|
10
|
+
"@id": "http://example.org/library/the-republic#introduction",
|
11
|
+
"@type": ["http://example.org/vocab#Chapter"],
|
12
|
+
"http://purl.org/dc/elements/1.1/description": [{"@value": "An introductory chapter on The Republic."}],
|
13
|
+
"http://purl.org/dc/elements/1.1/title": [{"@value": "The Introduction"}]
|
14
|
+
}]
|
15
|
+
}]
|
16
|
+
}]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"@context": {
|
3
|
+
"dc": "http://purl.org/dc/elements/1.1/",
|
4
|
+
"ex": "http://example.org/vocab#"
|
5
|
+
},
|
6
|
+
"@id": "http://example.org/library",
|
7
|
+
"@type": "ex:Library",
|
8
|
+
"ex:contains": {
|
9
|
+
"@id": "http://example.org/library/the-republic",
|
10
|
+
"@type": "ex:Book",
|
11
|
+
"dc:creator": "Plato",
|
12
|
+
"dc:title": "The Republic",
|
13
|
+
"ex:contains": {
|
14
|
+
"@id": "http://example.org/library/the-republic#introduction",
|
15
|
+
"@type": "ex:Chapter",
|
16
|
+
"dc:description": "An introductory chapter on The Republic.",
|
17
|
+
"dc:title": "The Introduction"
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
[{
|
2
|
+
"@id": {
|
3
|
+
"@id": "http://example.org/library"
|
4
|
+
},
|
5
|
+
"http://example.org/vocab#contains": {
|
6
|
+
"@id": "http://example.org/library/the-republic"
|
7
|
+
},
|
8
|
+
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {
|
9
|
+
"@id": "http://example.org/vocab#Library"
|
10
|
+
}
|
11
|
+
}, {
|
12
|
+
"@id": {
|
13
|
+
"@id": "http://example.org/library/the-republic"
|
14
|
+
},
|
15
|
+
"http://example.org/vocab#contains": {
|
16
|
+
"@id": "http://example.org/library/the-republic#introduction"
|
17
|
+
},
|
18
|
+
"http://purl.org/dc/elements/1.1/creator": "Plato",
|
19
|
+
"http://purl.org/dc/elements/1.1/title": "The Republic",
|
20
|
+
"@type": {
|
21
|
+
"@id": "http://example.org/vocab#Book"
|
22
|
+
}
|
23
|
+
}, {
|
24
|
+
"@id": {
|
25
|
+
"@id": "http://example.org/library/the-republic#introduction"
|
26
|
+
},
|
27
|
+
"http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.",
|
28
|
+
"http://purl.org/dc/elements/1.1/title": "The Introduction",
|
29
|
+
"@type": {
|
30
|
+
"@id": "http://example.org/vocab#Chapter"
|
31
|
+
}
|
32
|
+
}]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
@prefix dc: <http://purl.org/dc/elements/1.1/> .
|
2
|
+
@prefix ex: <http://example.org/vocab#> .
|
3
|
+
|
4
|
+
<http://example.org/library> a ex:Library;
|
5
|
+
ex:contains <http://example.org/library/the-republic> .
|
6
|
+
|
7
|
+
<http://example.org/library/the-republic> a ex:Book;
|
8
|
+
ex:contains <http://example.org/library/the-republic#introduction>;
|
9
|
+
dc:creator "Plato";
|
10
|
+
dc:title "The Republic" .
|
11
|
+
|
12
|
+
<http://example.org/library/the-republic#introduction> a ex:Chapter;
|
13
|
+
dc:description "An introductory chapter on The Republic.";
|
14
|
+
dc:title "The Introduction" .
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"@context": {
|
3
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
4
|
+
"name": "http://xmlns.com/foaf/0.1/name",
|
5
|
+
"age": {"@id": "http://xmlns.com/foaf/0.1/age", "@type": "xsd:integer"},
|
6
|
+
"homepage": {"@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@id"}
|
7
|
+
},
|
8
|
+
"name": "Manu Sporny",
|
9
|
+
"age": "41",
|
10
|
+
"homepage": "http://manu.sporny.org/"
|
11
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
{
|
2
|
+
"@context": {
|
3
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
4
|
+
"name": "http://xmlns.com/foaf/0.1/name",
|
5
|
+
"age": {"@id": "http://xmlns.com/foaf/0.1/age", "@type": "xsd:integer"},
|
6
|
+
"homepage": {"@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@id"}
|
7
|
+
}
|
8
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
[{
|
2
|
+
"http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}],
|
3
|
+
"http://xmlns.com/foaf/0.1/age": [{
|
4
|
+
"@type": "http://www.w3.org/2001/XMLSchema#integer",
|
5
|
+
"@value": "41"
|
6
|
+
}],
|
7
|
+
"http://xmlns.com/foaf/0.1/homepage": [{
|
8
|
+
"@id": "http://manu.sporny.org/"
|
9
|
+
}]
|
10
|
+
}]
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"@context": {
|
3
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
4
|
+
"name": "http://xmlns.com/foaf/0.1/name",
|
5
|
+
"age": {"@id": "http://xmlns.com/foaf/0.1/age", "@type": "xsd:integer"},
|
6
|
+
"homepage": {"@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@id"}
|
7
|
+
},
|
8
|
+
"name": "Manu Sporny",
|
9
|
+
"age": "41",
|
10
|
+
"homepage": "http://manu.sporny.org/"
|
11
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[{
|
2
|
+
"@id": {
|
3
|
+
"@id": "_:c14n0"
|
4
|
+
},
|
5
|
+
"http://xmlns.com/foaf/0.1/age": {
|
6
|
+
"@type": "http://www.w3.org/2001/XMLSchema#integer",
|
7
|
+
"@value": "41"
|
8
|
+
},
|
9
|
+
"http://xmlns.com/foaf/0.1/homepage": {
|
10
|
+
"@id": "http://manu.sporny.org/"
|
11
|
+
},
|
12
|
+
"http://xmlns.com/foaf/0.1/name": "Manu Sporny"
|
13
|
+
}]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"@context": [
|
3
|
+
{ "foaf": "http://xmlns.com/foaf/0.1/" },
|
4
|
+
{ "foaf:knows": { "@coerce": "@id" } }
|
5
|
+
],
|
6
|
+
"@id": "http://manu.sporny.org/#me",
|
7
|
+
"@type": "foaf:Person",
|
8
|
+
"foaf:name": "Manu Sporny",
|
9
|
+
"foaf:knows": {
|
10
|
+
"@type": "foaf:Person",
|
11
|
+
"foaf:name": "Gregg Kellogg"
|
12
|
+
}
|
13
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
[{
|
2
|
+
"@id": "http://manu.sporny.org/#me",
|
3
|
+
"@type": ["http://xmlns.com/foaf/0.1/Person"],
|
4
|
+
"http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}],
|
5
|
+
"http://xmlns.com/foaf/0.1/knows": [{
|
6
|
+
"@type": ["http://xmlns.com/foaf/0.1/Person"],
|
7
|
+
"http://xmlns.com/foaf/0.1/name": [{"@value": "Gregg Kellogg"}]
|
8
|
+
}]
|
9
|
+
}]
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{
|
2
|
+
"@context": [
|
3
|
+
{ "foaf": "http://xmlns.com/foaf/0.1/" },
|
4
|
+
{ "foaf:nick": { "@coerce": "@id", "@list": true } }
|
5
|
+
],
|
6
|
+
"@id": "http://example.org/people#joebob",
|
7
|
+
"@type": "foaf:Person",
|
8
|
+
"foaf:name": "Joe Bob",
|
9
|
+
"foaf:nick": [ "joe", "bob", "jaybe" ]
|
10
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
[{
|
2
|
+
"@id": "http://example.org/people#joebob",
|
3
|
+
"@type": ["http://xmlns.com/foaf/0.1/Person"],
|
4
|
+
"http://xmlns.com/foaf/0.1/name": [{"@value": "Joe Bob"}],
|
5
|
+
"http://xmlns.com/foaf/0.1/nick": [{ "@list": [
|
6
|
+
{"@value": "joe"},
|
7
|
+
{"@value": "bob"},
|
8
|
+
{"@value": "jaybe"}
|
9
|
+
]}]
|
10
|
+
}]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"@context": { "foaf": "http://xmlns.com/foaf/0.1/" },
|
3
|
+
"@id": [
|
4
|
+
{
|
5
|
+
"@type": "foaf:Person",
|
6
|
+
"foaf:homepage": "http://example.com/bob/",
|
7
|
+
"foaf:name": "Bob"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"@type": "foaf:Person",
|
11
|
+
"foaf:homepage": "http://example.com/eve/",
|
12
|
+
"foaf:name": "Eve"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"@type": "foaf:Person",
|
16
|
+
"foaf:homepage": "http://example.com/manu/",
|
17
|
+
"foaf:name": "Manu"
|
18
|
+
}
|
19
|
+
]
|
20
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"@context": { "foaf": "http://xmlns.com/foaf/0.1/" },
|
3
|
+
"@graph": [
|
4
|
+
{
|
5
|
+
"@id": "_:bnode1",
|
6
|
+
"@type": "foaf:Person",
|
7
|
+
"foaf:homepage": "http://example.com/bob/",
|
8
|
+
"foaf:name": "Bob"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"@id": "_:bnode2",
|
12
|
+
"@type": "foaf:Person",
|
13
|
+
"foaf:homepage": "http://example.com/eve/",
|
14
|
+
"foaf:name": "Eve"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"@id": "_:bnode3",
|
18
|
+
"@type": "foaf:Person",
|
19
|
+
"foaf:homepage": "http://example.com/manu/",
|
20
|
+
"foaf:name": "Manu"
|
21
|
+
}
|
22
|
+
]
|
23
|
+
}
|