Open mathib opened 4 years ago
Can you check https://github.com/ali1k/ld-r/blob/master/services/utils/helpers.js#L170 to see how read/write behavior for GraphDB is defined?
Read query:
SELECT DISTINCT ?s ?title WHERE {
{
SELECT DISTINCT ?s WHERE {
?s rdf:type ?type . FILTER (?type IN (<https://w3id.org/bot#Site>,<https://w3id.org/bot#Building>,<https://w3id.org/bot#Storey>,<https://w3id.org/bot#Space>,<https://w3id.org/bot#Element>))
}
LIMIT 30 OFFSET 0
}
OPTIONAL { ?s rdfs:label ?title . }
}
update query:
INSERT DATA {
<https://mytest.org/nodeA> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/1587740182> .
}
read query:
SELECT (count(DISTINCT ?s) AS ?total) WHERE {
GRAPH <http://www.openrdf.org/schema/sesame#nil> {
?s rdf:type ?type . FILTER (?type IN (<https://w3id.org/bot#Site>,<https://w3id.org/bot#Building>,<https://w3id.org/bot#Storey>,<https://w3id.org/bot#Space>,<https://w3id.org/bot#Element>))
}
}
update query:
INSERT DATA {
GRAPH <http://www.openrdf.org/schema/sesame#nil> {
<http://ld-r.org/n1587731670> <http://www.w3.org/2000/01/rdf-schema#label> """exampleValue1587740397""" .
}
}
hmm, I'm exploring GraphDBs way of dealing with NGs and it's pretty confusing at times. A short summary of the behaviour:
GRAPH <namedgraph>
, you'll only find the explicit triples inside that named graphFROM sesame:nil
, only the explicit triples in the default graph are foundMy current idea is to add another property for the server.js
config besides graphName
but for writing: writeGraphName
. While graphName
would be obligatory, it normally sets the read and write graph during querying using GRAPH <namedgraph>
except when default
is entered (this is the current situation). If however writeGraphName
exists, LD-R should write to the named graph mentioned here using GRAPH <namedgraph>
or the default graph in case of default
. LD-R still continues to read from the named or default graph as set in graphName
.
In case sesame:nil
is detected for graphName
, the read query should change GRAPH sesame:nil
into FROM sesame:nil
. The write query should then go to the default graph or if writeGraphName
is set, to the named graph set here.
Expected Behavior
By correctly setting the
server.js
config, I hope to query and write only to the default graph of my GraphDB instance.Actual Behavior
In the
server.js
config, I first set thegraphName
to'default'
, but this will also make LD-R retrieve triples from named graphs. When writing triples, they end up in the default graph. This is probably the expected behavior of GraphDB (also see this issue). To query the default graph only, I can write queries using the special named graphhttp://www.openrdf.org/schema/sesame#nil
to limit the query to the default graph.However, when I change in the
server.js
config the value ofgraphName
to'http://www.openrdf.org/schema/sesame#nil'
, I don't see any results appearing in LD-R. When making a new resource in LD-R, it is added to the named graphhttp://www.openrdf.org/schema/sesame#nil
. If I try the same query again directly on GraphDB, I don't see the new resource. Only when I specifically query the named graph itself, I can find it:I don't know which queries are send by LD-R, but I guess the read and write queries use
GRAPH
, similar as in the last query. Is it possible to make an exception for GraphDB ifgraphName
equals'http://www.openrdf.org/schema/sesame#nil'
? The read queries should be similar as the first query and the write queries should become something like:(no named graph in write queries, because it should go in the default graph instead of the 'virtual' named graph
http://www.openrdf.org/schema/sesame#nil
)Steps to Reproduce the Problem
Use configs in 'static' mode and run GraphDB locally
Specifications