Skip to content

Error: Unknown graph with iri ?g #76

Description

@tpluscode

Describe the bug

Insert/Where with a graph variable fails

To Reproduce

I tried to run the following query

PREFIX sh: <http://www.w3.org/ns/shacl#>

INSERT {
  GRAPH ?g { 
    ?shape sh:property ?property .
    ?property sh:group ?group . 
  }
} WHERE {
  GRAPH ?g { 
    ?shape <http://example.com/group> ?group .
    ?group <http://example.com/property> ?property . 
  }
}

This fails as seen below

node_modules/sparql-engine/dist/rdf/hashmap-dataset.js:81
            throw new Error("Unknown graph with iri " + iri);
            ^

Error: Unknown graph with iri ?g
    at HashMapDataset.getNamedGraph (node_modules/sparql-engine/dist/rdf/hashmap-dataset.js:81:19)
    at UpdateStageBuilder._buildInsertConsumer (node_modules/sparql-engine/dist/engine/stages/update-stage-builder.js:208:81)
    at node_modules/sparql-engine/dist/engine/stages/update-stage-builder.js:192:30
    at Array.map (<anonymous>)
    at UpdateStageBuilder._handleInsertDelete (node_modules/sparql-engine/dist/engine/stages/update-stage-builder.js:191:60)
    at node_modules/sparql-engine/dist/engine/stages/update-stage-builder.js:77:38
    at Array.map (<anonymous>)
    at UpdateStageBuilder.execute (node_modules/sparql-engine/dist/engine/stages/update-stage-builder.js:71:53)
    at PlanBuilder.build (node_modules/sparql-engine/dist/engine/plan-builder.js:211:73)
    at test.js:66:30

Expected behavior

The query should succeed, since ?g is a variable bound in the WHERE clause and not an IRI

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions