Skip to content

Various errors in SPARQL update #52

@doriantaylor

Description

@doriantaylor

Just registering this here as I'm in the middle of something, but I'm finding various errors when trying to use SPARQL update. Here's what I'm working with:

PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dct:  <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX ibis: <https://vocab.methodandstructure.com/ibis#>
PREFIX ci:   <https://vocab.methodandstructure.com/content-inventory#>
PREFIX cgto: <https://vocab.methodandstructure.com/graph-tool#>
PREFIX itcv: <https://vocab.methodandstructure.com/intertwingler#>

WITH <https://placeholder.ibis.makethingsmakesense.com/>
INSERT {
  ?s skos:inScheme <urn:uuid:cf16f32c-824a-47c2-b176-905c11f8978c> .
  # ?s ci:alias ?a .
}
WHERE {
  # BIND (?a AS (IRI(REPLACE(str(?s), "^urn:uuid:", "https://placeholder.ibis.makethingsmakesense.com/", "i"))))
  # ?s a ?o .
  # FILTER (?o IN (skos:Concept, ibis:Issue, ibis:Position, ibis:Argument))
  { ?s a skos:Concept } UNION { ?s a ibis:Issue } UNION { ?s a ibis:Position } UNION { ?s a ibis:Argument }
} ;

WITH <https://placeholder.ibis.makethingsmakesense.com/>
INSERT {
  ?s dct:creator <urn:uuid:ca637d4b-c11b-4152-be98-bde602e7abd4> .
}
WHERE {
  # { ?s a ?o } OPTIONAL { ?s dct:creator ?c }
  # FILTER (!BOUND(?c) && ?o IN (skos:Concept, ibis:Issue, ibis:Position, ibis:Argument))
  { ?s a skos:Concept } UNION { ?s a ibis:Issue } UNION { ?s a ibis:Position } UNION { ?s a ibis:Argument }
  OPTIONAL { ?s dct:creator ?c }
  FILTER (!bound(?c))
} ;

MOVE <https://placeholder.ibis.makethingsmakesense.com/> TO <dns:placeholder.methodandstructure.com>

This has been massaged into a non-breaking state but as you can see the commented-out bits are where the problems are:

  1. the IN operator doesn't seem to include ?o in the algebra and thus evaluates to false (ie nothing selected and therefore nothing inserted)
  2. that BIND just straight blows up during parsing with an error saying the operand is nil
  3. I also had accidentally left off the dct: prefix declaration and it didn't complain about the unbound prefix
  4. I guess the internal state of parsed queries get changed? because I can't seem to execute a parsed query twice without it raising
  5. I also get a 409 error in open_url (???) if I try to run the query twice on the repo, even if I reparse it.

Anyway, again, just registering this now but I'll circle back when I have some more time to look into it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions