marklogic / marklogic-jena

Adapter for using MarkLogic with the Jena RDF Framework
Other
5 stars 11 forks source link

Transverse RDF graph with Resource::getProperty(Property prop) #74

Closed AlexTo closed 5 years ago

AlexTo commented 6 years ago

Hi Just want to know whether it is possible to transverse the graph from a "starting" Resource. For example, after getting a Resource s as a result of a QueryExecution like so

QuerySolution rs = resultSet.nextSolution();
Resource s = rs.getResource("s");

Using Virtuoso Jena API or Jena, I can continue to transverse the RDF graph as follows

Resource s2 = s.getProperty(sProperty);
Resource s3 = s2.getProperty(s2Property);

But in MarkLogic Jena API, all I get is null. Can someone confirm whether it is implemented in MarkLogic Jena API ? Seem like after getting the Resource s, the resource is not an "attached" object and there is no link from the resource back to the original graph.

AlexTo commented 5 years ago

Sorry, this issue only happens when the resource is a blank node. I can transverse normally if the resource is a URI.

However still in Jena or Virtuoso, I can transverse even with blank node.

My solution is to convert all blank nodes to URI before saving to MarkLogic. For e.g. the blank node now becomes http://<mydomain>/bnodes/<blanknodeid>