You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I assumed MessageContentSerializer.deserialize would parse whatever turtle content and return the "root-most" resource (the subject that is not object to other statements), assuming there is only one. But that is not the case. Consider the following example (prefixes ommited for clarity):
<urn:org.universAAL.middleware.context.rdf:ContextEvent#_:0123456789abcdef:0001>
a :ContextEvent ;
:hasTimestamp "1521046800000"^^xsd:long ;
rdf:subject ex:mydevice ;
rdf:predicate dev:hasValue ;
rdf:object dev:Activated .
ex:mydevice a dev:SwitchActuator .
dev:Activated a dev:StatusValue .
This is properly deserialized as a ContextEvent java object. However only chaning the first line to be the last makes it fail:
dev:Activated a dev:StatusValue .
<urn:org.universAAL.middleware.context.rdf:ContextEvent#_:0123456789abcdef:0001>
a :ContextEvent ;
:hasTimestamp "1521046800000"^^xsd:long ;
rdf:subject ex:mydevice ;
rdf:predicate dev:hasValue ;
rdf:object dev:Activated .
ex:mydevice a dev:SwitchActuator .
This is deserialized as the Activated java object, despite being obviously not the root of the graph. I tracked this issue to TurtleParser.parseTriples in mw.data.serialization.turtle.core, where it clearly states:
// we found a new root node
// this is not generally true, since this subject could also appear
// later as rdf:object
But it does not do anything to modify that if it indeed appears later. Then in TurtleParser.finalizeAndGetRoot it simply returns the first root found, if no root is explicitly requested.
The text was updated successfully, but these errors were encountered:
I assumed MessageContentSerializer.deserialize would parse whatever turtle content and return the "root-most" resource (the subject that is not object to other statements), assuming there is only one. But that is not the case. Consider the following example (prefixes ommited for clarity):
This is properly deserialized as a ContextEvent java object. However only chaning the first line to be the last makes it fail:
This is deserialized as the Activated java object, despite being obviously not the root of the graph. I tracked this issue to TurtleParser.parseTriples in mw.data.serialization.turtle.core, where it clearly states:
But it does not do anything to modify that if it indeed appears later. Then in TurtleParser.finalizeAndGetRoot it simply returns the first root found, if no root is explicitly requested.
The text was updated successfully, but these errors were encountered: