%META:TOPICPARENT{name="VirtTipsAndTricksGuide"}%
---+How can I use SPARUL to add missing triples to a Named Graph?
---++What?
Use of SPARUL to add missing triples to a Named Graph. For example, an ontology/vocabulary extension.
---++Why?
A lot of ontologies and vocabularies started life prior to emergence of
the Linked Data meme. As a result, many do not include rdfs:isDefinedBy
relations (via triples) that associate Classes and Properties in an
ontology with the ontology itself, using de-referencable URIs. The
downside of this pattern is that Linked Data's follow-your-nose pattern
isn't exploitable when viewing these ontologies e.g., when using
contemporary Linked Data aware browsers, like the [[http://ode.openlinksw.com][OpenLink Data Explorer]], [[http://wikis.openlinksw.com/dataspace/owiki/wiki/OATWikiWeb/InteractiveSparqlQueryBuilderOverview][OpenLink iSPARQL Query Builder]], [[VirtVisualizeWithPivotViewer][Microsoft Pivot Viewer]] and others.
---++How?
If SPARUL privileges are assigned to SPARQL or other accounts associated
with SPARQL Endpoint. Or via WebID protected SPARQL endpoint with SPARUL
is granted to SPARQL or specific accounts or WebIDs in a group.
SPARQL INSERT INTO
{ ?s rdfs:DefinedBy .
?o rdfs:isDefinedBy . }
FROM
WHERE
{
?s a ?o
}
---+++Example
1 Load Quad Named Graph via Sponger based query:
DEFINE get:soft "replace"
SELECT DISTINCT *
FROM
WHERE
{
?s ?p ?o
}
%BR%%BR%
%BR%%BR%
1 Added Triples via SPARUL to Ontology Named Graph:
SPARQL INSERT INTO
{ ?s rdfs:DefinedBy .
?o rdfs:DefinedBy . }
FROM
WHERE
{
?s a ?o
}
Query result:
callret-0 VARCHAR
Insert into , 110 (or less) triples -- done
No. of rows in result: 1
1 Via Conductor or Command-line iSQL courtesy of SPASQL execute the following statements:
1 Remove an existing graph:
SPARQL
CLEAR GRAPH ;
SPARQL
CLEAR GRAPH ;
SPARQL
CLEAR GRAPH ;
Query result: callret-0
ANY
Clear -- done
No. of rows in result: 1
Query result: callret-0
ANY
Clear -- done
No. of rows in result: 1
Query result: callret-0
ANY
Clear -- done
No. of rows in result: 1
1 Load a new graph:
SPARQL
LOAD ;
Query result:
callret-0
VARCHAR
Load into graph -- done
No. of rows in result: 1
1 Add missing rdfs:isDefinedBy triples via SPARUL:
SPARQL
INSERT INTO
{ ?s rdfs:DefinedBy .
?o rdfs:DefinedBy . }
FROM
WHERE
{
?s a ?o
} ;
Query result:
callret-0
ANY
Insert into , 26 (or less) triples -- done
No. of rows in result: 1
1 Verification: Access the following url: http://<cname>/describe/?uri=http://www.w3.org/ns/auth/acl
%BR%%BR%
%BR%%BR%
---+++Related
* [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]]
* [[http://docs.openlinksw.com/virtuoso/sparqlextensions.html#rdfsparul][SPARUL -- an Update Language For RDF Graphs]]
* [[VirtSponger][Virtuoso Sponger]]
* [[http://ode.openlinksw.com][OpenLink Data Explorer]]
* [[http://wikis.openlinksw.com/dataspace/owiki/wiki/OATWikiWeb/InteractiveSparqlQueryBuilderOverview][OpenLink iSPARQL Query Builder]]
* [[VirtVisualizeWithPivotViewer][Microsoft Pivot Viewer]]