Java Code Examples for com.hp.hpl.jena.graph.Triple#create()
The following examples show how to use
com.hp.hpl.jena.graph.Triple#create() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeepPagingIterator.java From SolRDF with Apache License 2.0 | 6 votes |
@Override public Triple next() { try { final int nextDocId = iterator().nextDoc(); Triple triple = null; if (consumer.requireTripleBuild()) { final Document document = searcher.doc(nextDocId, TRIPLE_FIELDS); triple = Triple.create( NTriples.asURIorBlankNode((String) document.get(Field.S)), NTriples.asURI((String) document.get(Field.P)), NTriples.asNode((String) document.get(Field.O))); } else { triple = DUMMY_TRIPLE; } consumer.afterTripleHasBeenBuilt(triple, nextDocId); return triple; } catch (final IOException exception) { throw new RuntimeException(exception); } }
Example 2
Source File: DeepPagingIterator.java From SolRDF with Apache License 2.0 | 6 votes |
@Override public Triple next() { final SolrDocument document = iterator().next(); Triple triple = null; if (consumer.requireTripleBuild()) { triple = Triple.create( NTriples.asURIorBlankNode((String) document.getFieldValue(Field.S)), NTriples.asURI((String) document.getFieldValue(Field.P)), NTriples.asNode((String) document.getFieldValue(Field.O))); } else { triple = DUMMY_TRIPLE; } // FIXME // consumer.afterTripleHasBeenBuilt(triple, nextDocId); return triple; }
Example 3
Source File: ResourceDescriber.java From GeoTriples with Apache License 2.0 | 4 votes |
public Graph description() { if (executed) return result; executed = true; ExecutionContext context = new ExecutionContext( mapping.getContext(), null, null, null); final QueryIterConcat qIter = new QueryIterConcat(context); Pingback<?> pingback = null; if (timeout > 0) { pingback = AlarmClock.get().add(new Callback<Object>() { public void proc(Object ignore) { qIter.cancel(); } }, timeout); } FindQuery outgoing = new FindQuery( Triple.create(node, Node.ANY, Node.ANY), mapping.getTripleRelations(), limit, context); qIter.add(outgoing.iterator()); if (!onlyOutgoing) { FindQuery incoming = new FindQuery( Triple.create(Node.ANY, Node.ANY, node), mapping.getTripleRelations(), limit, context); qIter.add(incoming.iterator()); FindQuery triples = new FindQuery( Triple.create(Node.ANY, node, Node.ANY), mapping.getTripleRelations(), limit, context); qIter.add(triples.iterator()); } Iterator<Triple> it = TripleQueryIter.create(qIter); while (it.hasNext()) { result.add(it.next()); } if (pingback != null) { AlarmClock.get().cancel(pingback); } return result; }