/** Answer all of the commentary on the given resource, as a string */ protected String getComment( Resource r ) { StringBuffer comment = new StringBuffer(); // collect any RDFS or DAML comments attached to the node for (NodeIterator ni = m_source.listObjectsOfProperty( r, RDFS.comment ); ni.hasNext(); ) { RDFNode n = ni.nextNode(); if (n instanceof Literal) { comment.append( ((Literal) n).getLexicalForm().trim() ); } else { LoggerFactory.getLogger( getClass() ).debug( "Not a literal: " + n ); } } return comment.toString(); }
protected void prepareOneRefBNodes(Model model) { NodeIterator objIter = model.listObjects() ; for ( ; objIter.hasNext() ; ) { RDFNode n = objIter.nextNode() ; if ( testOneRefBNode(n) ) oneRefObjects.add(n) ; objIter.close() ; // N3JenaWriter.DEBUG if ( N3JenaWriter.DEBUG ) { out.println("# RDF Lists = "+rdfLists.size()) ; out.println("# RDF ListsAll = "+rdfListsAll.size()) ; out.println("# oneRefObjects = "+oneRefObjects.size()) ; } } }
/** * Name space stuff. */ private void addTypeNameSpaces() { NodeIterator nn = model.listObjectsOfProperty(RDF.type); try { while (nn.hasNext()) { RDFNode obj = nn.nextNode(); int split = isOKType(obj); if (split != -1) prettyWriter.addNameSpace(((Resource) obj).getURI() .substring(0, split)); } } finally { nn.close(); } }
NodeIterator nodeIt = model.listObjectsOfProperty(meRes, fieldProperty); while (nodeIt.hasNext()) { results.add(nodeIt.nextNode());
@Override public List<Node> getObjects(Node subject, Node predicate) { Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); SimpleSelector selector = getJenaSelector(graph, new StatementImpl(subject, predicate, null)); NodeIterator it = graph.listObjectsOfProperty(selector.getSubject(), selector.getPredicate()); List<Node> res = new ArrayList<Node>(); while (it.hasNext()) { res.add(getNXRelationsNode(it.nextNode().asNode())); } return res; } finally { if (graph != null) { graph.leaveCriticalSection(); } if (graphConnection != null) { graphConnection.close(); } } }
assertTrue("There is at least one value in range of parentWorkflow", iter.hasNext()); RDFNode node = iter.nextNode(); iter.close(); assertEquals(nestedWorkflowRun, node.toString());