0

Hi i have a rdf database and a graph called as urn:graph:2d6d3d07-20b0-4050-ada8-43e5655c919a and i want to query following construct statement to this graph how can i do that?

# Expand From IRIs 
CONSTRUCT {?iri ?predicate ?object .?object a ?object_type .?object <tag:stardog:studio:label> ?object_label_0 .?object rdfs:label ?object_label_1 .?object <http://purl.org/dc/elements/1.1/title> ?object_label_2 .?subject ?predicate_2 ?iri .?subject a ?subject_type .?subject <tag:stardog:studio:label> ?subject_label_0 .?subject rdfs:label ?subject_label_1 .?subject <http://purl.org/dc/elements/1.1/title> ?subject_label_2 .} 
WHERE {VALUES (?iri) {(<tag:stardog:api:0.13193948493419416>)}
       { ?iri ?predicate ?object .
        OPTIONAL { ?object a ?object_type . }
        OPTIONAL { ?object <tag:stardog:studio:label> ?object_label_0 . }
        OPTIONAL { ?object rdfs:label ?object_label_1 . }
        OPTIONAL { ?object <http://purl.org/dc/elements/1.1/title> ?object_label_2 . }
       } UNION {
        ?subject ?predicate_2 ?iri .
        OPTIONAL { ?subject a ?subject_type . }
        OPTIONAL { ?subject<tag:stardog:studio:label> ?subject_label_0 . }
        OPTIONAL { ?subject rdfs:label ?subject_label_1 . }
        OPTIONAL { ?subject <http://purl.org/dc/elements/1.1/title> ?subject_label_2 . }
       }
      } LIMIT 1000
UninformedUser
  • 8,397
  • 1
  • 14
  • 23
x jd
  • 23
  • 4
  • 2
    just use `GRAPH` keyword before the graph pattern in your `WHERE` clause as shown in the specs at https://www.w3.org/TR/sparql11-query/#queryDataset or also in the specs build the dataset before the `WHERE` clause, i.e. `CONSTRUCT {} FROM ... FROM NAMED ... WHERE {}`, see https://www.w3.org/TR/sparql11-query/#specifyingDataset – UninformedUser Jul 06 '21 at 19:13
  • @UninformedUser like 'construct {} from named where{}' ? – x jd Jul 06 '21 at 19:45
  • 1
    just use `CONSTRUCT { ... } WHERE { GRAPH { ... } }` and you are done. – UninformedUser Jul 07 '21 at 03:39

0 Answers0