Author: buildbot
Date: Fri Jan 13 14:10:35 2012
New Revision: 802553
Log:
Staging update by buildbot for stanbol
Modified:
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/factstore/specification.html
Modified:
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/factstore/specification.html
==============================================================================
---
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/factstore/specification.html
(original)
+++
websites/staging/stanbol/trunk/content/stanbol/docs/trunk/factstore/specification.html
Fri Jan 13 14:10:35 2012
@@ -188,149 +188,146 @@
<p>creates two new facts. The first one of type
http://iks-project.eu/ont/employeeof specifying that the person
http://upb.de/persons/bnagel is employee of the organization defined by the IRI
http://uni-paderborn.de. The second of type http://iks-project.eu/ont/friendOf
specifying that http://upb.de/persons/fchrist is a friend of
http://upb.de/persons/bnagel.</p>
<p>Status: <strong>Implemented</strong></p>
-<p>=== Query Interface ===</p>
+<h2 id="query_interface">Query Interface</h2>
<p>The query interface allows clients to query for facts and combination of
facts (reasoning). The JSON-LD query structure is inspired by SQL using SELECT
FROM [JOIN] WHERE constructs. Depending on the implementation the JSON-LD
queries may be transformed directly into valid SQL queries.</p>
-<p>==== Query for Facts of a Certain Type ====</p>
-<p>{|
- |valign="top"|Description:||Allows clients to query stored facts of a
specific type defined by the fact's schema. The clients specify the desired
fact plus an arbitrary number of entities that play some role in the fact.
- |-
- |Path:||/factstore/query
- |-
- |Method:||POST with data type application/json returns application/json
- |-
- |valign="top"|Data:||The query is specified by a JSON-LD object in the
payload of the request. The query defines a "select" to specify the desired
type of result to be returned in the result set. The "from" part specifies the
fact type to query and the "where" clause specifies constraints to be
fulfilled.<br>
-Note:For the moment constraints only support the equals "=" relation. There
may be more relations like ">" in future versions of this specification. If
there is more than one constraint all constraints are concatenated by "AND".
- |-
- |valign="top"|Example 1:||POST /factstore/query<br>
-with the following data"</p>
+<h3 id="query_for_facts_of_a_certain_type">Query for Facts of a Certain
Type</h3>
+<p>Allows clients to query stored facts of a specific type defined by the
fact's schema. The clients specify the desired fact plus an arbitrary number of
entities that play some role in the fact.</p>
+<p>Path: /factstore/query</p>
+<p>Method: POST with data type application/json returns application/json</p>
+<p>Data: The query is specified by a JSON-LD object in the payload of the
request. The query defines a "select" to specify the desired type of result to
be returned in the result set. The "from" part specifies the fact type to query
and the "where" clause specifies constraints to be fulfilled.</p>
+<p><em>Note</em>: For the moment constraints only support the equals "="
relation. There may be more relations like ">" in future versions of this
specification. If there is more than one constraint all constraints are
concatenated by "AND".</p>
+<p>Example 1: POST /factstore/query with the following data</p>
<p>{
- "@context" : {
- "iks" : "http://iks-project.eu/ont/"
- },
- "select" : [ "person" ],
- "from" : "iks:employeeOf",
- "where" : [
- {
- "=" : {
- "organization" : { "@iri" : "http://uni-paderborn.de" }
- }
- }
- ]
- }</p>
-<p><nowiki>returns the list of all persons participating in the fact of type
http://iks-project.eu/ont/employeeOf where the organization is
http://uni-paderborn.de. The result is sent back in JSON-LD format with the
result set specified by the select clause.</nowiki></p>
-<p>{
- "@subject" : [
- {
- "@subject" : "_bnode1",
- "PERSON" : "http://upb.de/persons/gengels"
- },
- {
- "@subject" : "_bnode2",
- "PERSON" : "http://upb.de/persons/ssauer"
+ "@context" : {
+ "iks" : "http://iks-project.eu/ont/"
},
- {
- "@subject" : "_bnode3",
- "PERSON" : "http://upb.de/persons/bnagel"
- },
- {
- "@subject" : "_bnode4",
- "PERSON" : "http://upb.de/persons/fchrist"
- }
- ]
- }</p>
-<p><nowiki>If there is only one entry in the result set, this would be
returned as follows.</nowiki></p>
-<p>{
- "PERSON" : "http://upb.de/persons/fchrist"
- }
- |-
- |valign="top"| Status: || Example 1 is implemented and should work in latest
[http://incubator.apache.org/stanbol/ Apache Stanbol] versions.
- |-
- |valign="top"| Example 2: || GET /factstore/query?q=<br>
-with the following data as the request parameter "q"
- {
- "@context" : {
- "iks" : "http://iks-project.eu/ont/"
- },
- "select" : [
- "person.name", "person.email"
- ],
- "from" : "iks:employeeOf",
- "where" : [
- {
- "=" : {
- "organization" : { "@iri" : "http://upb.de" }
- }
- }
- ]
- }</p>
-<p><nowiki>returns a list with names and e-mail addresses of all persons
participating in the fact of type http://iks-project.eu/ont/employeeOf where
the organization is http://upb.de. The result is sent back in JSON-LD format
with the result set specified by the select clause.</nowiki></p>
-<p>{
- "resultset": [
- { "person.name" : "Gregor Engels",
- "person.email": "[email protected]" },
- { "person.name" : "Stefan Sauer",
- "person.email": "[email protected]" },
- { "person.name" : "Benjamin Nagel",
- "person.email": "[email protected]" },
- { "person.name" : "Fabian Christ",
- "person.email": "[email protected]" }
- ]
- }
- |-
- |Status || Implemention in progress.
- |}</p>
-<p>==== Query for Combinations of Facts ====
-{|
- |Description:||Allows clients to query for combinations of facts.
- |-
- |Path:||/factstore/query?q=
- |-
- |Method:||GET with data type application/json returns application/json
- |-
- |Data:||The query is specified by a JSON-LD object in request parameter "q"
of the request. The query defines a "select" to specify the desired type of
result to be returned in the result set. Instead of using a "from" part this
type of query supports joins over facts using the "join" field. The "join"
field specifies which facts are joined by specifying the elements of the facts
that are evaluated to be equal during the join. The "where" clause specifies
constraints over the join to be fulfilled.<br>
-Note: For the moment constraints only support the equals "=" relation. There
may be more relations like ">" in future versions of this specification. If
there is more than one constraint all constraints are concatenated by "AND".
- |-
- |valign="top"|Example:||GET /factstore/query?q=<br>
-with the following request data in request parameter "q"</p>
-<p>{
- "@context" : {
- "iks" : "http://iks-project.eu/ont/"
- },
- "select": [
- "iks:friendOf.friend.name"
- ],
- "join" : {
- "iks:employeeOf.person" : "iks:friendOf.person"
- },
- "where" : [
- {
- "=" : {
- "iks:employeeOf.organization" : {
- "@iri" : "http://upb.de"
+ "select" : [ "person" ],
+ "from" : "iks:employeeOf",
+ "where" : [
+ {
+ "=" : {
+ "organization" : { "@iri" : "http://uni-paderborn.de" }
}
}
- },
- {
- "=" : {
- "iks:friendOf.friend.city" : "Paderborn"
- }
- }
- ]
- }
-<nowiki>
-will return a list of names of all the friends living in Paderborn of the
employees of the University of Paderborn. The result in JSON-LD format would
look like the following.</nowiki></p>
-<p>{
- "@context" : {
- "iks" : "http://iks-project.eu/ont/"
- },
- "resultset": [
- { "iks:friendOf.friend.name" : "Schmidt" },
- { "iks:friendOf.friend.name" : "Meier" },
- { "iks:friendOf.friend.name" : "Schneider" },
- { "iks:friendOf.friend.name" : "Schuster" }
- ]
- }</p>
-<p>|}</p>
+ ]
+ }</p>
+<p>returns the list of all persons participating in the fact of type
http://iks-project.eu/ont/employeeOf where the organization is
http://uni-paderborn.de. The result is sent back in JSON-LD format with the
result set specified by the select clause.</p>
+<div class="codehilite"><pre><span class="p">{</span>
+ <span class="s">"@subject"</span> <span class="p">:</span> <span
class="p">[</span>
+ <span class="p">{</span>
+ <span class="s">"@subject"</span> <span class="p">:</span>
<span class="s">"_bnode1"</span><span class="p">,</span>
+ <span class="s">"PERSON"</span> <span class="p">:</span>
<span class="s">"http://upb.de/persons/gengels"</span>
+ <span class="p">},</span>
+ <span class="p">{</span>
+ <span class="s">"@subject"</span> <span class="p">:</span>
<span class="s">"_bnode2"</span><span class="p">,</span>
+ <span class="s">"PERSON"</span> <span class="p">:</span>
<span class="s">"http://upb.de/persons/ssauer"</span>
+ <span class="p">},</span>
+ <span class="p">{</span>
+ <span class="s">"@subject"</span> <span class="p">:</span>
<span class="s">"_bnode3"</span><span class="p">,</span>
+ <span class="s">"PERSON"</span> <span class="p">:</span>
<span class="s">"http://upb.de/persons/bnagel"</span>
+ <span class="p">},</span>
+ <span class="p">{</span>
+ <span class="s">"@subject"</span> <span class="p">:</span>
<span class="s">"_bnode4"</span><span class="p">,</span>
+ <span class="s">"PERSON"</span> <span class="p">:</span>
<span class="s">"http://upb.de/persons/fchrist"</span>
+ <span class="p">}</span>
+ <span class="p">]</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>If there is only one entry in the result set, this would be returned as
follows.</p>
+<div class="codehilite"><pre><span class="p">{</span>
+ <span class="s">"PERSON"</span> <span class="p">:</span> <span
class="s">"http://upb.de/persons/fchrist"</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>Status: <strong>Example 1 is implemented</strong>.</p>
+<p>Example 2: GET /factstore/query?q= with the following data as the request
parameter "q"</p>
+<div class="codehilite"><pre><span class="p">{</span>
+ <span class="s">"@context"</span> <span class="p">:</span> <span
class="p">{</span>
+ <span class="s">"iks"</span> <span class="p">:</span> <span
class="s">"http://iks-project.eu/ont/"</span>
+ <span class="p">},</span>
+ <span class="s">"select"</span> <span class="p">:</span> <span
class="p">[</span>
+ <span class="s">"person.name"</span><span class="p">,</span>
<span class="s">"person.email"</span>
+ <span class="p">],</span>
+ <span class="s">"from"</span> <span class="p">:</span> <span
class="s">"iks:employeeOf"</span><span class="p">,</span>
+ <span class="s">"where"</span> <span class="p">:</span> <span
class="p">[</span>
+ <span class="p">{</span>
+ <span class="s">"="</span> <span class="p">:</span> <span
class="p">{</span>
+ <span class="s">"organization"</span> <span
class="p">:</span> <span class="p">{</span> <span
class="s">"@iri"</span> <span class="p">:</span> <span
class="s">"http://upb.de"</span> <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">]</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>returns a list with names and e-mail addresses of all persons participating
in the fact of type http://iks-project.eu/ont/employeeOf where the organization
is http://upb.de. The result is sent back in JSON-LD format with the result set
specified by the select clause.</p>
+<div class="codehilite"><pre><span class="p">{</span>
+ <span class="s">"resultset"</span><span class="p">:</span> <span
class="p">[</span>
+ <span class="p">{</span> <span class="s">"person.name"</span>
<span class="p">:</span> <span class="s">"Gregor Engels"</span><span
class="p">,</span>
+ <span class="s">"person.email"</span><span class="p">:</span>
<span class="s">"[email protected]"</span> <span class="p">},</span>
+ <span class="p">{</span> <span class="s">"person.name"</span>
<span class="p">:</span> <span class="s">"Stefan Sauer"</span><span
class="p">,</span>
+ <span class="s">"person.email"</span><span class="p">:</span>
<span class="s">"[email protected]"</span> <span class="p">},</span>
+ <span class="p">{</span> <span class="s">"person.name"</span>
<span class="p">:</span> <span class="s">"Benjamin Nagel"</span><span
class="p">,</span>
+ <span class="s">"person.email"</span><span class="p">:</span>
<span class="s">"[email protected]"</span> <span class="p">},</span>
+ <span class="p">{</span> <span class="s">"person.name"</span>
<span class="p">:</span> <span class="s">"Fabian Christ"</span><span
class="p">,</span>
+ <span class="s">"person.email"</span><span class="p">:</span>
<span class="s">"[email protected]"</span> <span class="p">}</span>
+ <span class="p">]</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>Status: <strong>NOT Implemented, yet.</strong></p>
+<h3 id="query_for_combinations_of_facts">Query for Combinations of Facts</h3>
+<p>Allows clients to query for combinations of facts.</p>
+<p>Path: /factstore/query?q=</p>
+<p>Method: GET with data type application/json returns application/json</p>
+<p>Data: The query is specified by a JSON-LD object in request parameter "q"
of the request. The query defines a "select" to specify the desired type of
result to be returned in the result set. Instead of using a "from" part this
type of query supports joins over facts using the "join" field. The "join"
field specifies which facts are joined by specifying the elements of the facts
that are evaluated to be equal during the join. The "where" clause specifies
constraints over the join to be fulfilled.</p>
+<p><em>Note</em>: For the moment constraints only support the equals "="
relation. There may be more relations like ">" in future versions of this
specification. If there is more than one constraint all constraints are
concatenated by "AND".</p>
+<p>Example: GET /factstore/query?q= with the following request data in request
parameter "q"</p>
+<div class="codehilite"><pre><span class="p">{</span>
+ <span class="s">"@context"</span> <span class="p">:</span> <span
class="p">{</span>
+ <span class="s">"iks"</span> <span class="p">:</span> <span
class="s">"http://iks-project.eu/ont/"</span>
+ <span class="p">},</span>
+ <span class="s">"select"</span><span class="p">:</span> <span
class="p">[</span>
+ <span class="s">"iks:friendOf.friend.name"</span>
+ <span class="p">],</span>
+ <span class="s">"join"</span> <span class="p">:</span> <span
class="p">{</span>
+ <span class="s">"iks:employeeOf.person"</span> <span
class="p">:</span> <span class="s">"iks:friendOf.person"</span>
+ <span class="p">},</span>
+ <span class="s">"where"</span> <span class="p">:</span> <span
class="p">[</span>
+ <span class="p">{</span>
+ <span class="s">"="</span> <span class="p">:</span> <span
class="p">{</span>
+ <span class="s">"iks:employeeOf.organization"</span> <span
class="p">:</span> <span class="p">{</span>
+ <span class="s">"@iri"</span> <span class="p">:</span>
<span class="s">"http://upb.de"</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">},</span>
+ <span class="p">{</span>
+ <span class="s">"="</span> <span class="p">:</span> <span
class="p">{</span>
+ <span class="s">"iks:friendOf.friend.city"</span> <span
class="p">:</span> <span class="s">"Paderborn"</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">]</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>will return a list of names of all the friends living in Paderborn of the
employees of the University of Paderborn. The result in JSON-LD format would
look like the following.</p>
+<div class="codehilite"><pre><span class="p">{</span>
+ <span class="s">"@context"</span> <span class="p">:</span> <span
class="p">{</span>
+ <span class="s">"iks"</span> <span class="p">:</span> <span
class="s">"http://iks-project.eu/ont/"</span>
+ <span class="p">},</span>
+ <span class="s">"resultset"</span><span class="p">:</span> <span
class="p">[</span>
+ <span class="p">{</span> <span
class="s">"iks:friendOf.friend.name"</span> <span class="p">:</span>
<span class="s">"Schmidt"</span> <span class="p">},</span>
+ <span class="p">{</span> <span
class="s">"iks:friendOf.friend.name"</span> <span class="p">:</span>
<span class="s">"Meier"</span> <span class="p">},</span>
+ <span class="p">{</span> <span
class="s">"iks:friendOf.friend.name"</span> <span class="p">:</span>
<span class="s">"Schneider"</span> <span class="p">},</span>
+ <span class="p">{</span> <span
class="s">"iks:friendOf.friend.name"</span> <span class="p">:</span>
<span class="s">"Schuster"</span> <span class="p">}</span>
+ <span class="p">]</span>
+<span class="p">}</span>
+</pre></div>
</div>
<div id="footer">