Skip to content
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

Migrate from quoted triples to triple terms #149

Merged
merged 5 commits into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 37 additions & 32 deletions spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7406,107 +7406,112 @@ <h5>TZ</h5>
</section>

<!-- QT -->
<section id="func-quoted-triples">
<h4>Functions on Quoted Triples</h4>
<section id="func-triple-terms">
<h4>Functions on Triple Terms</h4>
<section id="func-triple">
<h5>TRIPLE</h5>
<pre class="prototype nohighlight">
<span class="return">quoted triple</span> <span class="operator">TRIPLE</span> (<span class="type RDFterm">RDF term</span> <span class="name">subj</span>, <span class="type RDFterm">RDF term</span> <span class="name">pred</span>, <span class="type RDFterm">RDF term</span> <span
<span class="return">triple term</span> <span class="operator">TRIPLE</span> (<span class="type RDFterm">RDF term</span> <span class="name">subj</span>, <span class="type RDFterm">RDF term</span> <span class="name">pred</span>, <span class="type RDFterm">RDF term</span> <span
class="name">obj</span>)
</pre>
<pre class="query nohighlight">
<span class="operator">&lt;&lt;</span> subj pred obj <span class="operator">&gt;&gt;</span>
<span class="operator">&lt;&lt;(</span> subj pred obj <span class="operator">)&gt;&gt;</span>
</pre>
<p>
If the 3-tuple (<code style="color:black">subj</code>,
<code style="color:black">pred</code>,
<code style="color:black">obj</code>)
is an <a data-cite="RDF12-CONCEPTS#dfn-rdf-triple">RDF triple</a>
(that is, <code style="color:black">subj</code> is an
<a data-cite="RDF12-CONCEPTS#dfn-iri">IRI</a>,
<a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a> or
<a data-cite="RDF12-CONCEPTS#dfn-iri">IRI</a> or
<a data-cite="RDF12-CONCEPTS#dfn-blank-node">blank node</a>;
<code style="color:black">pred</code> is an
<a data-cite="RDF12-CONCEPTS#dfn-iri">IRI</a>;
and <code style="color:black">obj</code> is an
<a data-cite="RDF12-CONCEPTS#dfn-iri">IRI</a>,
<a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a>,
<a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple term</a>,
<a data-cite="RDF12-CONCEPTS#dfn-blank-node">blank node</a> or
<a data-cite="RDF12-CONCEPTS#dfn-literal">literal</a>)
the function returns a quoted triple with these three elements.
the function returns a triple term with these three elements.
Otherwise, the function raises an error.
</p>

<p>
As a shorthand notation, the <code>TRIPLE</code> function
can also be written in the form of a
<a href="#rExprQuotedTriple">quoted triple expression</a>
using <code>&lt;&lt;</code> and <code>&gt;&gt;</code>. There is a
<a href="#rExprTripleTerm">triple term expression</a>
using <code>&lt;&lt;(</code> and <code>)&gt;&gt;</code>. There is a
syntax limitation to this shorthand form: the three elements of
the quoted triple expression can only be variables and directly
the triple term expression can only be variables and directly
written RDF terms, not arbitrary expressions.
In contrast, the function form, <code>TRIPLE</code>,
can be used with arbitrary expressions.
</p>
<pre class="query nohighlight">
PREFIX : &lt;http://example/&gt;
PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;

SELECT ?s ?date {
?s ?p ?o
BIND( &lt;&lt; ?s ?p ?o &gt;&gt; AS ?qt )
?qt :tripleAdded ?date
?s ?p ?o .
BIND( &lt;&lt;( ?s ?p ?o )&gt;&gt; AS ?tt )
:myreifier rdf:reifies ?tt .
:myreifier :tripleAdded ?date .
}
</pre>
<pre class="query nohighlight">
PREFIX : &lt;http://example/&gt;
PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;

SELECT ?s ?date {
?s ?p ?o
BIND( TRIPLE(?s, ?p, ?o) AS ?qt )
?qt :tripleAdded ?date
?s ?p ?o .
BIND( TRIPLE(?s, ?p, ?o) AS ?tt )
:myreifier rdf:reifies ?tt .
:myreifier :tripleAdded ?date .
}
</pre>
</section>

<section id="func-subject">
<h5>SUBJECT</h5>
<pre class="prototype nohighlight"><span class="return">RDF term</span> <span class="operator">SUBJECT</span> (<span class="type RDFterm">quoted triple</span> <span class="name">quoted-triple</span>)</pre>
<pre class="prototype nohighlight"><span class="return">RDF term</span> <span class="operator">SUBJECT</span> (<span class="type RDFterm">triple term</span> <span class="name">triple-term</span>)</pre>
<p>
If the argument is a
<a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a>,
<a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple term</a>,
the function returns the
<a data-cite="RDF12-CONCEPTS#dfn-subject">subject</a>
of the quoted triple.
of the triple term.
If the argument is not a
<a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a>,
<a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple term</a>,
an error is raised.
</p>
</section>

<section id="func-predicate">
<h5>PREDICATE</h5>
<pre class="prototype nohighlight"><span class="return">RDF term</span> <span class="operator">PREDICATE</span> (<span class="type RDFterm">quoted triple</span> <span class="name">quoted-triple</span>)</pre>
<pre class="prototype nohighlight"><span class="return">RDF term</span> <span class="operator">PREDICATE</span> (<span class="type RDFterm">triple term</span> <span class="name">triple-term</span>)</pre>
<p>
If the argument is a
<a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a>,
<a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple term</a>,
the function returns the
<a data-cite="RDF12-CONCEPTS#dfn-predicate">predicate</a>
of the quoted triple.
of the triple term.
If the argument is not a
<a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a>,
<a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple term</a>,
an error is raised.
</p>
</section>

<section id="func-object">
<h5>OBJECT</h5>
<pre class="prototype nohighlight"><span class="return">RDF term</span> <span class="operator">OBJECT</span> (<span class="type RDFterm">quoted triple</span> <span class="name">quoted-triple</span>)</pre>
<pre class="prototype nohighlight"><span class="return">RDF term</span> <span class="operator">OBJECT</span> (<span class="type RDFterm">triple term</span> <span class="name">triple-term</span>)</pre>
<p>
If the argument is a
<a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a>,
<a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple term</a>,
the function returns the
<a data-cite="RDF12-CONCEPTS#dfn-object">object</a>
of the quoted triple.
of the triple term.
If the argument is not a
<a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a>,
<a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple term</a>,
an error is raised.
</p>
</section>
Expand All @@ -7515,7 +7520,7 @@ <h5>OBJECT</h5>
<h5>isTRIPLE</h5>
<pre class="prototype nohighlight"><span class="return">xsd:boolean</span> <span class="operator">isTRIPLE</span> (<span class="type RDFterm">RDF term</span> <span class="name">term</span>)</pre>
<p>
If the argument is a <a data-cite="RDF12-CONCEPTS#dfn-quoted-triple">quoted triple</a>,
If the argument is a <a data-cite="RDF12-CONCEPTS#dfn-triple-term">triple term</a>,
the function returns true.
If the argument is any other kind of
<a data-cite="RDF12-CONCEPTS#dfn-rdf-term">RDF term</a>,
Expand Down Expand Up @@ -11806,10 +11811,10 @@ <h2>Changes between SPARQL 1.1 Query Language and SPARQL 1.2 Query Language</h2>
Normative changes:
<ul>
<li>Remove concepts of plain and simple literals, in favor of explicit mentions of xsd:string</li>
<li>Update grammar for quoted triples and triple functions in <a href="#sparqlGrammar" class="sectionRef"></a></li>
<li>Update grammar for triple terms and triple functions in <a href="#sparqlGrammar" class="sectionRef"></a></li>
<li>Migrate XML Schema references to 1.1</li>
<li>Update references to XPath from 2.0 to 3.1</li>
<li>Add functions on quoted triples to <a href="#func-quoted-triples" class="sectionRef"></a></li>
<li>Add functions on triple terms to <a href="#func-triple-terms" class="sectionRef"></a></li>
</ul>
</li>
<li>
Expand Down
Loading