@Override public void derive(Node s, Node p, Node o) { if ( isTriple ) output.triple(Triple.create(s,p,o)) ; else output.quad(Quad.create(g,s,p,o)) ; } } ;
protected ExtendedIterator<Triple> propertyFiller(final Node s, final Iterator<ATermAppl> properties, final Node o) { return WrappedIterator.create(properties)// .filterKeep(JenaUtils._isGrapheNode)// .mapWith(JenaUtils::makeGraphNode)// .filterKeep(Optional::isPresent)// .mapWith(node -> Triple.create(s, node.get(), o)); }
private Triple convert(AResource s, AResource p, ALiteral o) { Node object = convert(o) ; checker.check(object, -1, -1) ; return Triple.create(convert(s), convert(p), object) ; }
@Override public Model remove( Resource s, Property p, RDFNode o ) { graph.delete( Triple.create( s.asNode(), p.asNode(), o.asNode() ) ); return this; }
/** * Utility factory as for create(String), but allowing the PrefixMapping to * be specified explicitly. */ public static Triple createTriple(PrefixMapping pm, String fact) { StringTokenizer st = new StringTokenizer(fact); Node sub = create(pm, st.nextToken()); Node pred = create(pm, st.nextToken()); Node obj = create(pm, st.nextToken()); return Triple.create(sub, pred, obj); }
/** Utility factory as for create(String), but allowing the PrefixMapping to be specified explicitly. */ public static Triple createTriple( PrefixMapping pm, String fact ) { StringTokenizer st = new StringTokenizer( fact ); Node sub = create( pm, st.nextToken() ); Node pred = create( pm, st.nextToken() ); Node obj = create( pm, st.nextToken() ); return Triple.create( sub, pred, obj ); }
private void readObject(java.io.ObjectInputStream in) throws IOException { TProtocol protocol = TRDF.protocol(in); RDF_Term tterm = new RDF_Term(); Node s = SerializerRDF.read(protocol, tterm); Node p = SerializerRDF.read(protocol, tterm); Node o = SerializerRDF.read(protocol, tterm); triple = Triple.create(s, p, o); }
public static Triple convert(RDF_Triple rt, PrefixMap pmap) { Node s = convert(rt.getS(), pmap) ; Node p = convert(rt.getP(), pmap) ; Node o = convert(rt.getO(), pmap) ; return Triple.create(s, p, o) ; }
private Triple transform(Triple triple) { Node s = triple.getSubject() ; Node s1 = transform(s) ; Node p = triple.getPredicate() ; Node p1 = transform(p) ; Node o = triple.getObject() ; Node o1 = transform(o) ; if ( s == s1 && p == p1 && o == o1 ) return triple ; return Triple.create(s1, p1, o1) ; }
/** Weak test for "same graph": adding this to one is visible in t'other. Stopgap for use in testCanFindCreatedGraph. TODO: clean that test up (left over from RDB days) */ private boolean sameGraph( Graph g1, Graph g2 ) { Node S = node( "S" ), P = node( "P" ), O = node( "O" ); g1.add( Triple.create( S, P, O ) ); g2.add( Triple.create( O, P, S ) ); return g2.contains( S, P, O ) && g1.contains( O, P, S ); }
/** Weak test for "same graph": adding this to one is visible in t'other. Stopgap for use in testCanFindCreatedGraph. TODO: clean that test up (left over from RDB days) */ private boolean sameGraph( Graph g1, Graph g2 ) { Node S = node( "S" ), P = node( "P" ), O = node( "O" ); g1.add( Triple.create( S, P, O ) ); g2.add( Triple.create( O, P, S ) ); return g2.contains( S, P, O ) && g1.contains( O, P, S ); }
/** * Weak test for "same graph": adding this to one is visible in t'other. * Stopgap for use in testCanFindCreatedGraph. TODO: clean that test up * (left over from RDB days) */ private boolean sameGraph(Graph g1, Graph g2) { Node S = GraphHelper.node("S"), P = GraphHelper.node("P"), O = GraphHelper .node("O"); g1.add(Triple.create(S, P, O)); g2.add(Triple.create(O, P, S)); return g2.contains(S, P, O) && g1.contains(O, P, S); }
/** * Weak test for "same graph": adding this to one is visible in t'other. * Stopgap for use in testCanFindCreatedGraph. TODO: clean that test up * (left over from RDB days) */ private boolean sameGraph(Graph g1, Graph g2) { Node S = GraphHelper.node("S"), P = GraphHelper.node("P"), O = GraphHelper .node("O"); g1.add(Triple.create(S, P, O)); g2.add(Triple.create(O, P, S)); return g2.contains(S, P, O) && g1.contains(O, P, S); }
@Override public void run() { out.start(); out.triple(Triple.create(org.apache.jena.graph.NodeFactory.createURI("urn:s"), org.apache.jena.graph.NodeFactory.createURI("urn:p"), org.apache.jena.graph.NodeFactory.createURI("urn:o"))); throw new RuntimeException("die!"); } };
@Override public void run() { out.start(); out.triple(Triple.create(org.apache.jena.graph.NodeFactory.createURI("urn:s"), org.apache.jena.graph.NodeFactory.createURI("urn:p"), org.apache.jena.graph.NodeFactory.createURI("urn:o"))); out.finish() ; throw new RuntimeException("die!"); } });
public void testTripleCreate() { Node S = NodeCreateUtils.create( "s" ), P = NodeCreateUtils.create( "p" ), O = NodeCreateUtils.create( "o" ); assertEquals( new Triple( S, P, O ), Triple.create( S, P, O ) ); }
/** This test case was generated by Ian and was caused by GraphMem not keeping up with changes to the find interface. */ public void testFindAndContains() { Graph g = getGraph(); Node r = NodeCreateUtils.create( "r" ), s = NodeCreateUtils.create( "s" ), p = NodeCreateUtils.create( "P" ); g.add( Triple.create( r, p, s ) ); assertTrue( g.contains( r, p, Node.ANY ) ); assertEquals( 1, g.find( r, p, Node.ANY ).toList().size() ); }
/** This test case was generated by Ian and was caused by GraphMem not keeping up with changes to the find interface. */ public void testFindAndContains() { Graph g = getGraph(); Node r = NodeCreateUtils.create( "r" ), s = NodeCreateUtils.create( "s" ), p = NodeCreateUtils.create( "P" ); g.add( Triple.create( r, p, s ) ); assertTrue( g.contains( r, p, Node.ANY ) ); assertEquals( 1, g.find( r, p, Node.ANY ).toList().size() ); }