-
Notifications
You must be signed in to change notification settings - Fork 35
RDF to Object conversion (closing #555) #619
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
Changes from 5 commits
3d4391c
5fb21fa
52a47a4
17edb1b
0b32f75
2f34954
fd224e1
fd89aed
2c51796
05139b0
7e5167e
35f105c
d02a82b
d4cd1f6
5161fc4
a6132a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# JetBrains IDEs | ||
.idea/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5156,17 +5156,89 @@ <h3>Overview</h3> | |
and generating a JSON-LD document in expanded form for all | ||
<a>RDF literals</a>, <a>IRIs</a> | ||
and <a>blank node identifiers</a>. | ||
If the <a data-link-for="JsonLdOptions">useNativeTypes</a> flag is set to <code>true</code>, | ||
<a>RDF literals</a> with a | ||
<a>datatype IRI</a> | ||
that equals <code>xsd:integer</code> or <code>xsd:double</code> are converted | ||
to a <a>JSON numbers</a> and <a>RDF literals</a> | ||
with a <a>datatype IRI</a> | ||
that equals <code>xsd:boolean</code> are converted to <code>true</code> or | ||
<code>false</code> based on their | ||
<a>lexical form</a> | ||
as described in | ||
<a class="sectionRef" href="#data-round-tripping"></a>. | ||
|
||
If the <a data-link-for="JsonLdOptions">useNativeTypes</a> flag is set | ||
to <code>true</code>, <a>RDF literals</a> are converted to JSON values | ||
based on their <a>datatype IRI</a> and <a>lexical form</a> as described | ||
in <a class="sectionRef" href="#data-round-tripping"></a>. | ||
</p> | ||
|
||
<table class="simple"> | ||
anatoly-scherbakov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<thead> | ||
<th>RDF datatype</th> | ||
<th>Values</th> | ||
<th>JSON</th> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<th>(<em>None</em>, implying <code>xsd:string</code>)</th> | ||
<td rowspan="2">An RDF string literal</td> | ||
<td rowspan="2">JSON string literal</td> | ||
</tr> | ||
<tr> | ||
<th><code>xsd:string</code></th> | ||
</tr> | ||
anatoly-scherbakov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<tr> | ||
<th rowspan="3"><code>xsd:integer</code></th> | ||
<td>Whole number in the <code>[-2<sup>53</sup> + 1, 2<sup>53</sup> + 1]</code> range, representable as per [[IEEE-754-2008]]</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are more constraints in the lexical form of an xsd:integer than this. Also, while it's likely consistent with JCS/ECMAScript, such numbers also need to be representable as integers in JCS/ECMAScript. See Appendix B. |
||
<td><a>JSON Number</a></td> | ||
</tr> | ||
|
||
<tr> | ||
<td>Whole number out of that range</td> | ||
<td>JSON string literal</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, this needs to be serialized as a value object with |
||
</tr> | ||
|
||
<tr> | ||
<td>Any other value</td> | ||
<td>Raise an error</td> | ||
</tr> | ||
|
||
<tr> | ||
<th rowspan="3"><code>xsd:double</code></th> | ||
<td>Real number in the <code>[-2<sup>53</sup> + 1, 2<sup>53</sup> + 1]</code> range, representable as per [[IEEE-754-2008]]</td> | ||
<td><a>JSON Number</a></td> | ||
</tr> | ||
|
||
<tr> | ||
<td>Real number out of that range</td> | ||
<td>JSON string literal</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above comment; the ranges should be consistent with XSD and JCS and probably shouldn't re-define the criteria. |
||
</tr> | ||
|
||
<tr> | ||
<td> | ||
Non-numeric values: | ||
|
||
<ul> | ||
<li><code>"NaN"^^xsd:double</code>,</li> | ||
<li><code>"+INF"^^xsd:double</code>,</li> | ||
<li><code>"-INF"^^xsd:double</code></li> | ||
</ul> | ||
</td> | ||
<td rowspan="2">Raise an error</td> | ||
</tr> | ||
<tr> | ||
<td>Any other value</td> | ||
</tr> | ||
|
||
<tr> | ||
<th rowspan="3"><code>xsd:boolean</code></th> | ||
<td><code>true</code></td> | ||
<td><code>true</code></td> | ||
</tr> | ||
<tr> | ||
<td><code>false</code></td> | ||
<td><code>false</code></td> | ||
</tr> | ||
<tr> | ||
<td>Any other value</td> | ||
<td>Raise an error</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<p> | ||
Unless the <a data-link-for="JsonLdOptions">useRdfType</a> flag is set to true, <code>rdf:type</code> | ||
predicates will be serialized as <code>@type</code> as long as the associated object is | ||
either an <a>IRI</a> or <a>blank node identifier</a>.</p> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<http://example.com/Subj1> <http://example.com/prop> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> . | ||
<http://example.com/Subj1> <http://example.com/prop> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> . | ||
<http://example.com/Subj1> <http://example.com/prop> "1"^^<http://www.w3.org/2001/XMLSchema#integer> . | ||
<http://example.com/Subj1> <http://example.com/prop> "1.1"^^<http://www.w3.org/2001/XMLSchema#decimal> . | ||
<http://example.com/Subj1> <http://example.com/prop> "+INF"^^<http://www.w3.org/2001/XMLSchema#double> . |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ | ||
{ | ||
"@id": "http://example.com/Subj1", | ||
"http://example.com/prop": [ | ||
{ "@value": true }, | ||
{ "@value": false }, | ||
{ "@value": 1 }, | ||
{ "@value": "1.1", "@type": "http://www.w3.org/2001/XMLSchema#decimal"}, | ||
{ "@value": "+INF", "@type": "http://www.w3.org/2001/XMLSchema#double"} | ||
] | ||
} | ||
] |
Uh oh!
There was an error while loading. Please reload this page.