Skip to content

Describing @direction #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/ruby-rdf/json-ld.git
revision: adbd407fa4b5783c8a7f7b79653b6e38815ff854
revision: c1e72171960b31bf417c7af9ecea6ebf75fd0316
branch: develop
specs:
json-ld (3.0.2)
Expand Down Expand Up @@ -34,10 +34,10 @@ GEM
hamster (3.0.0)
concurrent-ruby (~> 1.0)
htmlentities (4.3.4)
i18n (1.6.0)
i18n (1.7.0)
concurrent-ruby (~> 1.0)
json-canonicalization (0.1.0)
json-ld-preloaded (3.0.4)
json-ld-preloaded (3.0.5)
json-ld (~> 3.0)
multi_json (~> 1.12)
rdf (~> 3.0)
Expand Down Expand Up @@ -83,7 +83,7 @@ GEM
nokogiri
public_suffix (4.0.1)
rack (2.0.7)
rake (12.3.3)
rake (13.0.0)
rdf (3.0.12)
hamster (~> 3.0)
link_header (~> 0.0, >= 0.0.8)
Expand Down Expand Up @@ -135,7 +135,7 @@ GEM
rdf-turtle (3.0.6)
ebnf (~> 1.1)
rdf (~> 3.0)
rdf-vocab (3.0.10)
rdf-vocab (3.0.11)
rdf (~> 3.0, >= 3.0.11)
rdf-xsd (3.0.1)
rdf (~> 3.0)
Expand Down
7 changes: 7 additions & 0 deletions common/extract-examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ def table_to_dataset(table)
# We might think something was an IRI, but determine that it's not
object = RDF::Literal(object.to_s, language: cell.to_sym)
end
when 'Direction'
case cell
when '-', /^\s*$/
else
object = RDF::Literal(object.to_s, datatype: RDF::URI("https://www.w3.org/ns/i18n##{object.language}_#{cell}"))
# We might think something was an IRI, but determine that it's not
end
end
end
repo << RDF::Statement.new(subject, predicate, object, graph_name: gname)
Expand Down
4 changes: 4 additions & 0 deletions common/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@
whose value MUST be a <a>string</a> representing a [[BCP47]] language code or <code>null</code>.</dd>
<dt><dfn data-cite="JSON-LD11#dfn-default-object">default object</dfn></dt><dd>
A <a>default object</a> is a <a>map</a> that has a <code>@default</code> key.</dd>
<dt><dfn data-cite="JSON-LD11#dfn-base-direction" data-lt="default base direction">base direction</dfn></dt><dd>
The <a>base direction</a> is the direction used when a string does not have a direction associated with it directly.
It can be set in the <a>context</a> using the <code>@direction</code> key
whose value MUST be one of the strings `"ltr"`, `"rtl"`, or <code>null</code>.</dd>
<dt><dfn data-cite="JSON-LD11#dfn-embedded-context">embedded context</dfn></dt><dd>
An embedded <a>context</a> is a context which appears
as the <code>@context</code> <a>entry</a> of one of the following:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><table class="statements" data-result-for="A protected @context with an exception-expanded" data-to-rdf>
<html><body><table class="statements" data-result-for="A protected @context with an exception-expanded" data-to-rdf data-no-lint>
<thead><tr>
<th>Subject</th>
<th>Property</th>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"@context": {
"Type1": "http://example.com/vocab/Type1",
"Type2": "http://example.com/vocab/Type2",
"term1": "http://example.com/vocab#term1",
"term2": "http://example.com/vocab#term2"
}
}
19 changes: 11 additions & 8 deletions examples/Clearing-default-language.jsonld
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"@context": {
"@language": "ja"
"@version": 1.1,
"@vocab": "http://example.com/",
"@language": "ar-EG",
"@direction": "rtl",
"details": {
"@context": {
"@direction": null
}
}
},
"name": "花澄",
"details": {
"@context": {
"@language": null
},
"occupation": "Ninja"
}
"title": "HTML و CSS: تصميم و إنشاء مواقع الويب",
"details": {"genre": "Technical Publication"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"@context": [
"https://json-ld.org/contexts/person.jsonld",
{
"pic": "http://xmlns.com/foaf/0.1/depiction"
"pic": {
"@id": "http://xmlns.com/foaf/0.1/depiction",
"@type": "@id"
}
}
],
"name": "Manu Sporny",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}],
"http://xmlns.com/foaf/0.1/homepage": [{"@id": "http://manu.sporny.org/"}],
"http://xmlns.com/foaf/0.1/depiction": [{
"@value": "http://twitter.com/account/profile_image/manusporny"
"@id": "http://twitter.com/account/profile_image/manusporny"
}]
}]
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<td>_:b0</td>
<td>foaf:depiction</td>
<td>http://twitter.com/account/profile_image/manusporny</td>
<td>xsd:string</td>
<td>IRI</td>
</tr>
</tbody>
</table></body></html>
2 changes: 1 addition & 1 deletion examples/Combining-external-and-local-contexts-turtle.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
[
foaf:name "Manu Sporny";
foaf:homepage <http://manu.sporny.org/>;
foaf:depiction "http://twitter.com/account/profile_image/manusporny"
foaf:depiction <http://twitter.com/account/profile_image/manusporny>
] .
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><table class="statements" data-result-for="Combining multiple JSON-LD script elements into a single dataset-original" data-to-rdf>
<html><body><table class="statements" data-result-for="Combining multiple JSON-LD script elements into a single dataset-compacted" data-to-rdf>
<thead><tr>
<th>Subject</th>
<th>Property</th>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@context": {
"@vocab": "http://xmlns.com/foaf/0.1/"
"@vocab": "http://example.org/"
},
"@id": "http://example.org/places#BrewEats",
"@type": "Restaurant",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@context": {
"@vocab": "http://xmlns.com/foaf/0.1/"
"@vocab": "http://example.org/"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[{
"@id": "http://example.org/places#BrewEats",
"@type": ["http://xmlns.com/foaf/0.1/Restaurant"],
"http://xmlns.com/foaf/0.1/name": [{"@value": "Brew Eats"}]
"@type": ["http://example.org/Restaurant"],
"http://example.org/name": [{"@value": "Brew Eats"}]
}]
32 changes: 0 additions & 32 deletions examples/Context-defined-in-an-HTML-document.html

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><table class="statements" data-result-for="Defining an @context within a term definition used on @type-expanded" data-to-rdf>
<html><body><table class="statements" data-result-for="Defining an @context within a term definition used on @type-expanded" data-to-rdf data-no-lint>
<thead><tr>
<th>Subject</th>
<th>Property</th>
Expand Down
10 changes: 10 additions & 0 deletions examples/Defining-property-nesting-Context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"@context": {
"@version": 1.1,
"skos": "http://www.w3.org/2004/02/skos/core#",
"labels": "@nest",
"main_label": {"@id": "skos:prefLabel", "@nest": "labels"},
"other_label": {"@id": "skos:altLabel", "@nest": "labels"},
"homepage": {"@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@id"}
}
}
2 changes: 1 addition & 1 deletion examples/Defining-property-nesting-statements.table
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><table class="statements" data-result-for="Defining property nesting-expanded" data-to-rdf>
<html><body><table class="statements" data-result-for="Defining property nesting - Expanded Input" data-to-rdf>
<thead><tr>
<th>Subject</th>
<th>Property</th>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"@context": {
"Person": "http://xmlns.com/foaf/0.1/Person",
"name": "http://xmlns.com/foaf/0.1/name",
"knows": {"@id": "http://xmlns.com/foaf/0.1/knows", "@type": "@id"}
},
"@included": [{
"@id": "http://manu.sporny.org/about#manu",
"@type": "Person",
"name": "Manu Sporny",
"knows": "https://greggkellogg.net/foaf#me"
}, {
"@id": "https://greggkellogg.net/foaf#me",
"@type": "Person",
"name": "Gregg Kellogg",
"knows": "http://manu.sporny.org/about#manu"
}]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[{
"@included": [{
"@id": "http://manu.sporny.org/about#manu",
"@type": ["http://xmlns.com/foaf/0.1/Person"],
"http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}],
"http://xmlns.com/foaf/0.1/knows": [
{"@id": "https://greggkellogg.net/foaf#me"}
]
}, {
"@id": "https://greggkellogg.net/foaf#me",
"@type": ["http://xmlns.com/foaf/0.1/Person"],
"http://xmlns.com/foaf/0.1/name": [{"@value": "Gregg Kellogg"}],
"http://xmlns.com/foaf/0.1/knows": [
{"@id": "http://manu.sporny.org/about#manu"}
]
}]
}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[{
"@id": "http://manu.sporny.org/about#manu",
"@type": ["http://xmlns.com/foaf/0.1/Person"],
"http://xmlns.com/foaf/0.1/name": [{"@value": "Manu Sporny"}],
"http://xmlns.com/foaf/0.1/knows": [
{"@id": "https://greggkellogg.net/foaf#me"}
]
}, {
"@id": "https://greggkellogg.net/foaf#me",
"@type": ["http://xmlns.com/foaf/0.1/Person"],
"http://xmlns.com/foaf/0.1/name": [{"@value": "Gregg Kellogg"}],
"http://xmlns.com/foaf/0.1/knows": [
{"@id": "http://manu.sporny.org/about#manu"}
]
}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><table class="statements" data-result-for="Describing disconnected nodes with @included-expanded" data-to-rdf>
<thead><tr>
<th>Subject</th>
<th>Property</th>
<th>Value</th>
<th>Value Type</th>
</tr></thead>
<tbody>
<tr>
<td>http://manu.sporny.org/about#manu</td>
<td>rdf:type</td>
<td>foaf:Person</td>
<td> </td>
</tr>
<tr>
<td>http://manu.sporny.org/about#manu</td>
<td>foaf:name</td>
<td>Manu Sporny</td>
<td> </td>
</tr>
<tr>
<td>http://manu.sporny.org/about#manu</td>
<td>foaf:knows</td>
<td>https://greggkellogg.net/foaf#me</td>
<td> </td>
</tr>
<tr>
<td>https://greggkellogg.net/foaf#me</td>
<td>rdf:type</td>
<td>foaf:Person</td>
<td> </td>
</tr>
<tr>
<td>https://greggkellogg.net/foaf#me</td>
<td>foaf:name</td>
<td>Gregg Kellogg</td>
<td> </td>
</tr>
<tr>
<td>https://greggkellogg.net/foaf#me</td>
<td>foaf:knows</td>
<td>http://manu.sporny.org/about#manu</td>
<td> </td>
</tr>
</tbody>
</table></body></html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://manu.sporny.org/about#manu> a foaf:Person;
foaf:name "Manu Sporny";
foaf:knows <https://greggkellogg.net/foaf#me> .
<https://greggkellogg.net/foaf#me> a foaf:Person;
foaf:name "Gregg Kellogg";
foaf:knows <http://manu.sporny.org/about#manu> .
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><table class="original selected" data-result-for="Example demonstrating the context-sensitivity for @type" data-to-rdf>
<html><body><table class="compacted input selected" data-result-for="Example demonstrating the context-sensitivity for @type" data-to-rdf>
<thead><tr>
<th>Subject</th>
<th>Property</th>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"@context": {
"@version": 1.1,
"@language": "ar-EG",
"@direction": "rtl",
"ex": "http://example.com/vocab/",
"publisher": { "@id": "ex:publisher", "@direction": null },
"title": { "@id": "ex:title" },
"title_en": { "@id": "ex:title", "@language": "en", "@direction": "ltr" }
},
"publisher": "مكتبة",
"title": "HTML و CSS: تصميم و إنشاء مواقع الويب",
"title_en": "HTML and CSS: Design and Build Websites"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"@context": {
"@vocab": "http://example.com/vocab/",
"property": "http://example.com/vocab/property",
"Type1": "http://example.com/vocab/Type1",
"Type2": "http://example.com/vocab/Type2"
},
"property": {
"@context": [{
"term1": "http://example.com/vocab/term1"
}, {
"term2": "http://example.com/vocab/term2"
}, {
"term3": "http://example.com/vocab/term3"
}, {
"term4": "http://example.com/vocab/term4"
}],
"@type": ["Type2", "Type1"],
"term1": "a",
"term2": "b",
"term3": "c",
"term4": "d"
}
}
Loading