- Common ways to obtain Triple
private void myMethod () {Triple t =
ExtendedIterator extendedIterator;extendedIterator.next()
Node s;Node p;Node o;new Triple(s, p, o)
Node s;Node p;Node o;Triple.create(s, p, o)
- Smart code suggestions by Codota
}
/** Get as a triple - useful because quads often come in blocks for the same graph */ public Triple asTriple() { return new Triple(subject, predicate, object) ; }
@Override void addSuccessors( Node base, TransitiveGraphCache tgc, ArrayList<Triple> result ) { for (Iterator<GraphNode> j = components.iterator(); j.hasNext(); ) { result.add( new Triple(base, tgc.closedPredicate, j.next().rdfNode) ); } }
/** Return as a triple when the path is a simple, 1-link, else return null */ public Triple asTriple() { if ( triple != null ) return triple ; if ( path instanceof P_Link ) triple = new Triple(subject, ((P_Link)path).getNode(), object) ; return triple ; }
public TriplePath(Node s, Path path, Node o) { this.subject = s ; this.object = o ; if ( path instanceof P_Link ) { this.predicate = ((P_Link)path).getNode() ; triple = new Triple(subject, this.predicate , o) ; } else this.predicate = null ; this.path = path ; }
/** Return as a triple when the path is a simple, 1-link, else return null */ public Triple asTriple() { if ( triple != null ) return triple ; if ( path instanceof P_Link ) triple = new Triple(subject, ((P_Link)path).getNode(), object) ; return triple ; }
@Override public void visit(P_Link pathNode) { Op op = new OpTriple(new Triple(subject, pathNode.getNode(), object)) ; result = op ; }
@Override public void add(Node g , Node s, Node p, Node o) { if ( Quad.isDefaultGraph(g) ) graph.add(new Triple(s, p, o)) ; else throw new UnsupportedOperationException("DatasetGraphOne.add/named graph") ; }
@Override public void delete(Node g , Node s, Node p, Node o) { if ( Quad.isDefaultGraph(g) ) graph.delete(new Triple(s, p, o)) ; else throw new UnsupportedOperationException("DatasetGraphOne.delete/named graph") ; }
final public void Object(Node s, Node p) throws ParseException { Node o ; o = GraphNode(); Triple t = new Triple(s,p,o) ; emitTriple(token.beginLine, token.beginColumn, t) ; }
protected void insert(TripleCollector acc, Node s, Node p, Path path, Node o) { if ( p == null ) acc.addTriplePath(new TriplePath(s, path, o)) ; else acc.addTriple(new Triple(s, p, o)) ; }
@Override public Triple read(Kryo kryo, Input input, Class<Triple> type) { final Node s = (Node) kryo.readClassAndObject(input); final Node p = (Node) kryo.readClassAndObject(input); final Node o = (Node) kryo.readClassAndObject(input); return new Triple(s, p, o); }
protected void insert(TripleCollectorMark acc, int index, Node s, Node p, Path path, Node o) { if ( p == null ) acc.addTriplePath(index, new TriplePath(s, path, o)) ; else acc.addTriple(index, new Triple(s, p, o)) ; }
@Override public Triple read(Kryo kryo, Input input, Class<Triple> type) { final Node s = (Node) kryo.readClassAndObject(input); final Node p = (Node) kryo.readClassAndObject(input); final Node o = (Node) kryo.readClassAndObject(input); return new Triple(s, p, o); }
/** * Return the final instantiated goal given the current binding state. */ public Triple getResult() { return new Triple( LPInterpreter.deref(argVars[0]), LPInterpreter.deref(argVars[1]), LPInterpreter.derefPossFunctor(argVars[2])); }
@Override public Triple next() { Binding b = iter.nextBinding(); Node S = b.get(varS) ; Node P = b.get(varP) ; Node O = b.get(varO) ; return new Triple(S,P,O) ; } @Override public void close() { iter.close() ; }
private static Triple _buildNode3(ItemList list) { Node s = BuilderNode.buildNode(list.get(0)) ; Node p = BuilderNode.buildNode(list.get(1)) ; Node o = BuilderNode.buildNode(list.get(2)) ; return new Triple(s, p, o) ; }
private static void contains(TripleTable table, Node s, Node p, Node o) { Iterator<Triple> iter = table.find(s, p, o) ; assertNotNull(iter) ; assertTrue(iter.hasNext()) ; assertEquals(new Triple(s, p, o), iter.next()) ; assertFalse(iter.hasNext()) ; }
@Test public void add1() { TripleTable table = createTripleTableMem() ; table.add(new Triple(n1,n2,n3)) ; }
public void visit(OpPropFunc opPropFunc) { Node s = processPropFuncArg(opPropFunc.getSubjectArgs()) ; Node o = processPropFuncArg(opPropFunc.getObjectArgs()) ; Triple t = new Triple(s, opPropFunc.getProperty(), o) ; currentGroup().addElement(process(t)) ; }
@Override public void visit(OpPropFunc opPropFunc) { Node s = processPropFuncArg(opPropFunc.getSubjectArgs()) ; Node o = processPropFuncArg(opPropFunc.getObjectArgs()) ; Triple t = new Triple(s, opPropFunc.getProperty(), o) ; currentGroup().addElement(process(t)) ; }