Thanks Adam. I was actually wondering why rdflib would behave in a different way using an in-memory store (it actually allows you to delete triples from any graph by not specifying one). I am still testing this under both scenarios but what you say makes sense.

Best,
Stefano

On 12/20/2017 08:21 AM, ajs6f wrote:
Just to be clear, Stefano, the default graph is a read-only view specifically 
_because_ you set `tdb:unionDefaultGraph` to true.

Suppose three named graphs all contain the same triple and therefore that 
triple appears in a union default graph. If you try to delete the triple from 
the union, it's not clear from which of the named graphs it should be deleted. 
If you don't set the default graph to be a union, it behaves much like any 
named graph (wrt mutation).

ajs6f

On Dec 19, 2017, at 4:01 PM, Stefano Cossu <[email protected]> wrote:

Thanks for the clarification Andy. I was not aware of the fact that the default 
graph is just a read-only view.

Stefano

On 12/19/2017 02:56 PM, Andy Seaborne wrote:
Stefano,
Is there any way I can specify a union graph IRI for update?
The triples really are in the named graph - the default graph for query is a 
view of all the named graphs.  To delete, delete from the named graph and they 
will disappear from the default graph (if there are not in another graph as 
well).
DELETE DATA {
    GRAPH <urn:g:1> {
           <urn:s:1> <urn:p:1> <urn:o:1>
    }
}
In an update the default graph changes go to the real (storage) default graph.
     Andy
On 19/12/17 17:53, Stefano Cossu wrote:
Hello,

I have inserted this data set on a TDB-backed database, with the 
`tdb:unionDefaultGraph` option set to true:

INSERT DATA {
   GRAPH <urn:g:1> {
     <urn:s:1> <urn:p:1> <urn:o:1> .
     <urn:s:1> <urn:p:1> <urn:o:2> .
   }
}


If I query the default graph I can see the triples:

SELECT * {
   ?s ?p ?o .
}

However, if I try to delete triples from the default graph without naming the 
named graph, the triples won't go away:

DELETE {
   <urn:s:1> <urn:p:1> <urn:o:1> .
} WHERE {
   <urn:s:1> <urn:p:1> <urn:o:1> .
}

If I specify the named graph, or use a variable for it, the triple is deleted. 
However, I am using Python's RDFLib to manage the interaction with Fuseki and I 
don't have an easy way to perform an update query on a graph indicated by a 
variable.

The default Jena graph name `<urn:x-arq:UnionGraph>` won't work either.

My configuration is pretty standard:

@prefix :      <http://base/#> .

@prefix tdb:   <http://jena.hpl.hp.com/2008/tdb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:    <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .


:service_tdb_all  a                   fuseki:Service ;
         rdfs:label                    "TDB dev" ;
         fuseki:dataset                :tdb_dataset_readwrite ;
         fuseki:name                   "dev" ;
         fuseki:serviceQuery           "query" , "sparql" ;
         fuseki:serviceReadGraphStore  "get" ;
         fuseki:serviceReadWriteGraphStore
                 "data" ;
         fuseki:serviceUpdate          "update" ;
         fuseki:serviceUpload          "upload" .


:tdb_dataset_readwrite
         a             tdb:DatasetTDB ;
         tdb:unionDefaultGraph true ;
         tdb:location  "/opt/fuseki/current/run/databases/dev" .


Is there any way I can specify a union graph IRI for update?

Thanks,
Stefano



--
Stefano Cossu
Director of Application Services, Collections

The Art Institute of Chicago
116 S. Michigan Ave.
Chicago, IL 60603
312-499-4026

Reply via email to