Practical use (and reuse) of CONSTRUCTION clause

When used CONSTRUCTin a sparql query, the output is a single RDF graph , as well as a set of triples, which are essentially new data, but in general, I thought that was CONSTRUCTa way to manually create a rule that theoretically should be reused.


In a usage example CONSTRUCT, let's say I wanted to define what was not yet in the data. Here is a good example taken from an article about CONSTRUCT .

@prefix : <http://some.site.com/ont#> .

:jane :hasParent :gene .
:gene :hasParent :pat ;
      :gender    :female .
:joan :hasParent :pat ;
      :gender    :female . 
:pat  :gender    :male .
:mike :hasParent :joan .

"The following CONSTRUCT statement creates new triples based on the above to indicate who the grandfather is:"

PREFIX : <http://some.site.com/ont#>

CONSTRUCT { ?p :hasGrandfather ?g . }
WHERE {?p      :hasParent ?parent .
       ?parent :hasParent ?g .
       ?g      :gender    :male .
}

and the result:

@prefix :        <http://some.site.com/ont#> .
:jane    :hasGrandfather    :pat .
:mike    :hasGrandfather    :pat .

CONSTRUCT, , , / :hasGrandfather? RDF-, SQL?

, CONSTRUCT?

+4
2

SPARQL 1.1, , INSERT ( ). 3.1 SPARQL 1.1:

3.1

Graph Store, . , , , , , , , , . (, ). , .

SPARQL 1.1 Update :...

  • , , - INSERT DELETE ( DELETE/INSERT). , , . . INSERT/DELETE INSERT DATA /DELETE DATA: INSERT DATA DELETE DATA . DATA ( , DELETE DATA INSERT DATA , DELETE DATA, . 8 + 9 ). , , .

:

8:

:

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

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

Joshua answer, , , , , , OWL , ( ). , OWL, SWRL, .

, SPARQL, Stardog SPARQL SWRL; SWRL, . SPIN, , , SPARQL , .

+2

Source: https://habr.com/ru/post/1524571/


All Articles