0

I'm attempting to add a Graph node to a Model (N3 formula)

The output should be roughly like the below:

<http://localhost:8080/patches/#cf0ba48fa8b0421c8b025c3ea6b41a4f>
        a       <http://www.w3.org/ns/solid/terms#Patch> ;
        <http://www.w3.org/ns/solid/terms#patches>
                <http://example.com/#me> ;
        <http://www.w3.org/ns/solid/terms#inserts> { http://example.com/#me http://example.com/#property http://example.com/#resource } .

Note that the #inserts property here is a "GraphNode" or N3 formula, I'm modelling a graph of the triples to write when a Task is complete

I tried the code below:

Model out = ModelFactory.createDefaultModel();
out.add(endState, SolidTerms.inserts, out.asRDFNode(NodeFactory.createGraphNode(inserts.getGraph())));

but this throws [org.apache.jena.sparql.ARQInternalErrorException: Unknown node type: {http://example.com/#me @http://example.com/#property http://example.com/#resource}]

I've tried many other ways of putting the Graph in the model with no success, posting this one because it was my first and I think the most rational. Maybe it's a bug or Jena just doesn't support the GraphNode type in RDFNode ?

The @ in the output puzzled me a bit, but I checked that it's not included in my property definition, it's maybe added in by the createGraphNode or the error serialization

AndyS
  • 16,345
  • 17
  • 21
  • Jena does not support N3 formula. `NodeFactory.createGraphNode` is no more than a placeholder and as per javadoc: "For experimentation.Otherwise, unsupported." The rest of the code base does not know about them. – AndyS Feb 06 '21 at 15:24
  • Could you link to the Java doc please ? The documentation I'm reading at https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/graph/NodeFactory.html just has: "Create a graph node. This is an N3-formula; it is not a named graph (see "quad")" – Calum Mackervoy Feb 08 '21 at 10:22

0 Answers0