Open th1j5 opened 4 years ago
Maybe worse: if I say the old and new graph come from different documents (see code)
const $rdf = require('rdflib');
const store = $rdf.graph();
$rdf.parse(old_graph, store, 'https://www.example.com/1', 'text/turtle');
$rdf.parse(new_graph, store, 'https://www.example.com/2', 'text/turtle');
console.log($rdf.serialize(null, store, 'https://www.example.com/', 'text/turtle'));
I get this:
@prefix : </#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix b: <http://basisLeshan.com/>.
@prefix om: <https://florsanders.inrupt.net/public/ontologies/omalwm2m.ttl#>.
@prefix n0: <http://basisLeshan.com/device1/3303/>.
b:device1
a om:Device, om:Device;
om:contains n0:0, n0:0.
n0:0
a om:ObjectInstance, om:ObjectInstance;
om:consistsOf _:_g_L5C354, _:_g_L5C354;
om:containedBy b:device1, b:device1.
_:_g_L5C354
a om:5700, om:5700, om:ResourceInstance, om:ResourceInstance;
om:hasTimeStamp
"2020-04-16T08:24:03.755Z"^^xsd:dateTime,
"2020-04-16T08:26:32.988Z"^^xsd:dateTime;
om:hasValue "-2.5"^^xsd:float, "-5.1"^^xsd:float;
om:organizedInto n0:0, n0:0.
This means that: all triples are doubled (see for ex. b:device1 a om:Device, om:Device;
)
But the blank node is still merged!! I think this is not how it should be?
I'm hitting the same problem. What is the best way to work around this?
This updating in BlankNode appears to be the culprit:
I think that the abstract nextId
counter is not synchronised across class instances when data is loaded asynchronously?
I'm using rdflib in a project to update an existing graph with new data. This new data contains a bit overhead, because it is possible a certain 'device1' already exists, but when merging with the old graph they have the same IRI's and thus mean the same. We are using blank nodes to represent different measurements. Old graph:
new Graph:
(The only difference is a different value & timestamp)
When I would merge them, I would expect these 2 blank nodes to kept seperate, because there is nothing that could suggest otherwise. This is also the behavior of rdflib in python.
Thus:
gives:
With 2 separate blank nodes, like expected, also according to the specs (if I understand them correct)
When I use rdflib.js however, these blank nodes get mangled into 1:
Like you see here:
This would (to my understanding and expectations) not be according the RDF specs? So, is this a bug or is there another way this should be done? If there is anything that can clarify my question, ask me!