GraphStore`
GraphStore`

SPARQLQuery

SPARQLQuery[query]

is a query operator that can be applied to an RDFStore.

SPARQLQuery["query"]

uses a SPARQL query string.

Details

  • SPARQLQuery can be used in SPARQLExecute to query a SPARQL endpoint.
  • query can be a SPARQLSelect, SPARQLAsk or SPARQLConstruct operator.
  • An aggregate can be specified as SPARQLQuery[SPARQLSelect[]/*SPARQLAggregate[]].
  • The following options can be given:
  • "Base"Automaticbase IRI used to resolve relative IRIs
    "From"Automaticdefault graph to query
    "FromNamed"Automaticlist of named graphs to query
  • With the setting "From"{iri1,iri2,} the RDF merge of the graphs identified by the irii is used as default graph.
  • SPARQLQuery[File[...]] and SPARQLQuery[URL[...]] are also supported.

Examples

open all close all

Basic Examples  (1)

In[1]:=
Click for copyable input

Specify an example RDF graph:

In[2]:=
Click for copyable input
In[3]:=
Click for copyable input

Query all the data associated with a given subject:

In[4]:=
Click for copyable input
Out[4]=

Query all the data associated with a given predicate:

In[5]:=
Click for copyable input
Out[5]=

Find all the subjects that have a certain value for a given predicate:

In[6]:=
Click for copyable input
Out[6]=

Find the values of predicate "a" for subjects that have a certain value for predicate "b":

In[7]:=
Click for copyable input
Out[7]=

Aggregate solutions:

In[8]:=
Click for copyable input
Out[8]=

Group and aggregate solutions:

In[9]:=
Click for copyable input
Out[9]=

Scope  (2)