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 OpenLink Data Explorer, OpenLink iSPARQL Query Builder, 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 <LocalNamedGraphIRI>
  { ?s rdfs:DefinedBy <LocalOntologyEntityURI>.
    ?o rdfs:isDefinedBy <http://www.w3.org/ns/auth/acl>. }
FROM <ExtSourceNamedGraphIRI> 
WHERE 
  { 
    ?s a ?o 
  }

Example

  1. Load Quad Named Graph via Sponger based query:

    DEFINE get:soft "replace" SELECT DISTINCT * FROM <http://www.w3.org/ns/auth/acl#> WHERE { ?s ?p ?o }





  2. Added Triples via SPARUL to Ontology Named Graph:

    SPARQL INSERT INTO <http://www.w3.org/ns/auth/acl#> { ?s rdfs:DefinedBy <http://www.w3.org/ns/auth/acl>. ?o rdfs:DefinedBy <http://www.w3.org/ns/auth/acl>. } FROM <http://www.w3.org/ns/auth/acl#> WHERE { ?s a ?o } Query result: callret-0 VARCHAR Insert into <http://www.w3.org/ns/auth/acl#>, 110 (or less) triples -- done No. of rows in result: 1

  3. Via Conductor or Command-line iSQL courtesy of SPASQL execute the following statements:
    1. Remove an existing graph:

      SPARQL CLEAR GRAPH <http://www.w3.org/ns/auth/acl/> ; SPARQL CLEAR GRAPH <http://www.w3.org/ns/auth/acl> ; SPARQL CLEAR GRAPH <http://www.w3.org/ns/auth/acl#> ; Query result: callret-0 ANY Clear <http://www.w3.org/ns/auth/acl/> -- done No. of rows in result: 1 Query result: callret-0 ANY Clear <http://www.w3.org/ns/auth/acl> -- done No. of rows in result: 1 Query result: callret-0 ANY Clear <http://www.w3.org/ns/auth/acl#> -- done No. of rows in result: 1

    2. Load a new graph:

      SPARQL LOAD <http://www.w3.org/ns/auth/acl> ; Query result: callret-0 VARCHAR Load <http://www.w3.org/ns/auth/acl> into graph <http://www.w3.org/ns/auth/acl> -- done No. of rows in result: 1

    3. Add missing rdfs:isDefinedBy triples via SPARUL:

      SPARQL INSERT INTO <http://www.w3.org/ns/auth/acl> { ?s rdfs:DefinedBy <http://www.w3.org/ns/auth/acl>. ?o rdfs:DefinedBy <http://www.w3.org/ns/auth/acl>. } FROM <http://www.w3.org/ns/auth/acl> WHERE { ?s a ?o } ; Query result: callret-0 ANY Insert into <http://www.w3.org/ns/auth/acl>, 26 (or less) triples -- done No. of rows in result: 1

  4. Verification: Access the following url: http://<cname>/describe/?uri=http://www.w3.org/ns/auth/acl



Related