I should have added, instead of ReifiedStatement myReifiedStmt = myOntology.createReifiedStatement(myNodeURI, queryStmt);
I also tried Statement s = myOntology.createStatement(queryStmt.getSubject(), queryStmt.getPredicate(), queryStmt.getObject()); ReifiedStatement myReifiedStmt = myOntology.createReifiedStatement(myNodeURI, s); and got the same exception from org.apache.jena.graph.Node.getBlankNodeId(Node.java:86) On 9/30/2017 11:52 AM, Dave Reynolds wrote: > On 30/09/17 16:31, Steve Vestal wrote: >> When I execute the following org.apache.jena.rdf.model.Model method >> >> ReifiedStatement myReifiedStatement = >> myOntology.createReifiedStatement(myNodeName, myStatement); >> >> where myStatement is an org.apache.jena.rdf.model.Statement in a Model >> returned by an org.apache.jena.query.Query#execConstruct query of >> myOntology, I get the exception >> >> org.eclipse.e4.core.di.InjectionException: >> java.lang.UnsupportedOperationException: >> http://www.test.com/test#myNodeName is not a blank node > > That exception is not from Jena but some other part of your > application or test suite. > >> The code >> >> ReifiedStatement myReifiedStatement = >> myOntology.createReifiedStatement(myStatement); >> >> seems to work OK. How do I create a ReifiedStatement in myOntology as >> an explicitly named resource? > > You pass the URI for the ReifiedStatement as the first argument to > createReifiedStatement just as you tried, works fine. E.g. try > > Model m = ModelFactory.createDefaultModel(); > Resource a = m.createResource(NS + "a"); > Statement s = m.createStatement(a, RDFS.label, "a"); > m.add(s); > ReifiedStatement r = m.createReifiedStatement(NS + "statement", s); > m.write(System.out, "Turtle"); > > to see that the created reified statement has the expected URI. > > Dave
