SPARUL

SPARUL, or SPARQL/Update, was a declarative data manipulation language that extended the SPARQL 1.0 query language standard. SPARUL provided the ability to insert, delete and update RDF data held within a triple store or quad store. SPARUL was originally written by Hewlett-Packard and has been used as the foundation for the current W3C recommendation entitled SPARQL 1.1 Update.[1] With the publication of SPARQL 1.1, SPARUL is superseded and should only be consulted as a source of inspiration for possible future refinements of SPARQL, but not for real-world applications.

Examples

Adding some triples to a graph. The snippet describes two RDF triples to be inserted into the default graph of the RDF store.

PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT DATA
{ <http://example/book3> dc:title    "A new book" ;
                         dc:creator  "A.N.Other" .
}

This SPARQL/Update request contains a triple to be deleted and a triple to be added (used here to correct a book title). The requested change happens in the named graph identified by the URI http://example/bookStore.

PREFIX dc: <http://purl.org/dc/elements/1.1/>

DELETE DATA FROM <http://example/bookStore>
{ <http://example/book3>  dc:title  "Fundamentals of Compiler Design" }

INSERT DATA INTO <http://example/bookStore>
{ <http://example/book3>  dc:title  "Fundamentals of Compiler Design" }

The example below has a request to delete all records of old books (with date before year 2000)

PREFIX dc:  <http://purl.org/dc/elements/1.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

DELETE
 { ?book ?p ?v }
WHERE
  { ?book dc:date ?date .
    FILTER ( ?date < "2000-01-01T00:00:00"^^xsd:dateTime )
    ?book ?p ?v
  }

This snippet copies records from one named graph to another named graph based on a pattern.

PREFIX dc:  <http://purl.org/dc/elements/1.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

INSERT INTO <http://example/bookStore2>
 { ?book ?p ?v }
WHERE
  { GRAPH  <http://example/bookStore>
       { ?book dc:date ?date .
         FILTER ( ?date < "2000-01-01T00:00:00"^^xsd:dateTime )
         ?book ?p ?v
  } }

An example to move records from one named graph to another named graph based on a pattern.

PREFIX dc:  <http://purl.org/dc/elements/1.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

INSERT INTO <http://example/bookStore2>
 { ?book ?p ?v }
WHERE
  { GRAPH  <http://example/bookStore>
     { ?book dc:date ?date .
       FILTER ( ?date < "2000-01-01T00:00:00"^^xsd:dateTime )
       ?book ?p ?v
     }
  }
DELETE FROM <http://example/bookStore>
 { ?book ?p ?v }
WHERE
  { GRAPH  <http://example/bookStore>
      { ?book dc:date ?date .
        FILTER ( ?date < "2000-01-01T00:00:00"^^xsd:dateTime )
        ?book ?p ?v
      }
  }

SPARQL/Update implementations

Clients supporting SPARUL

References

  1. ^ "SPARQL 1.1 Update". www.w3.org. Retrieved 2021-01-07.
  2. ^ D2R Server
  3. ^ "Parliament". Archived from the original on 2014-04-30. Retrieved 2012-06-30.
  4. ^ "The Tabulator"

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.