Refine search
static private Node makeURI(String uri) { return uri == null ? NodeFactory.createBlankNode() : NodeFactory.createURI( uri ); }
/** Recover a Node from a stored Lucene string */ public static Node stringToNode(String v) { if ( v.startsWith("_:") ) { v = v.substring("_:".length()) ; return NodeFactory.createBlankNode(v) ; } else return NodeFactory.createURI(v) ; } }
protected Node makeNodeForURI(String vitroURIStr) { if (vitroURIStr.indexOf(PSEUDO_BNODE_NS)==0) { return NodeFactory.createBlankNode(vitroURIStr.split("#")[1]); } else { return NodeFactory.createURI(vitroURIStr); } }
/** Recover a Node from a stored Lucene string */ public static Node stringToNode(String v) { if ( v.startsWith("_:") ) { v = v.substring("_:".length()) ; return NodeFactory.createBlankNode(v) ; } else return NodeFactory.createURI(v) ; }
/** Recover a Node from a stored Lucene string */ public static Node stringToNode(String v) { if ( v.startsWith("_:") ) { v = v.substring("_:".length()) ; return NodeFactory.createBlankNode(v) ; } else return NodeFactory.createURI(v) ; }
/** Recover a Node from a stored Lucene string */ public static Node stringToNode(String v) { if ( v.startsWith("_:") ) { v = v.substring("_:".length()) ; return NodeFactory.createBlankNode(v) ; } else return NodeFactory.createURI(v) ; } }
protected Node createNode(String iri) { // Is it a bNode label? i.e. <_:xyz> if ( isBNodeIRI(iri) ) { String s = iri.substring(bNodeLabelStart.length()) ; Node n = NodeFactory.createBlankNode(s) ; return n ; } return NodeFactory.createURI(iri) ; }
protected Node createNode(String iri) { // Is it a bNode label? i.e. <_:xyz> if ( isBNodeIRI(iri) ) { String s = iri.substring(bNodeLabelStart.length()) ; Node n = NodeFactory.createBlankNode(s) ; return n ; } return NodeFactory.createURI(iri) ; }
/** Implement {@code <_:....>} as a "Node IRI" * that is, use the given label as the BNode internal label. * Use with care. */ public static Node createIRIorBNode(String iri) { // Is it a bNode label? i.e. <_:xyz> if ( isBNodeIRI(iri) ) { String s = iri.substring(bNodeLabelStart.length()); Node n = NodeFactory.createBlankNode(s); return n; } return NodeFactory.createURI(iri); }
private static Node convert(AResource r) { if (!r.isAnonymous()) return NodeFactory.createURI(r.getURI()); // String id = r.getAnonymousID(); Node rr = (Node) r.getUserData(); if (rr == null) { rr = NodeFactory.createBlankNode(); r.setUserData(rr); } return rr; }
private static Node convert(AResource r) { if (!r.isAnonymous()) return NodeFactory.createURI(r.getURI()); // String id = r.getAnonymousID(); Node rr = (Node) r.getUserData(); if (rr == null) { rr = NodeFactory.createBlankNode(); r.setUserData(rr); } return rr; }
@Before public void setup() { tripleArray = new Triple[] { new Triple(NodeFactory.createURI("http://example.com/1"), NodeFactory.createURI("http://example.com/v"), NodeFactory.createBlankNode()), new Triple(NodeFactory.createURI("http://example.com/2"), NodeFactory.createURI("http://example.com/v"), NodeFactory.createBlankNode()), new Triple(NodeFactory.createURI("http://example.com/3"), NodeFactory.createURI("http://example.com/v"), NodeFactory.createBlankNode()) }; } }
private List<Quad> writeQuads(StreamRDF out, int size) { List<Quad> results = new ArrayList<>(); out.start(); for (int i = 1; i <= size; i++) { Quad q = new Quad(NodeFactory.createURI("http://graph"), NodeFactory.createBlankNode(), NodeFactory.createURI("http://predicate"), NodeFactoryExtra.intToNode(i)); out.quad(q); results.add(q); } out.finish(); return results; }
@Override public boolean bodyCall(Node[] args, int length, RuleContext context) { checkArgs(length, context); BindingEnvironment env = context.getEnv(); Triple t = new Triple( NodeFactory.createBlankNode(), NodeFactory.createURI("http://jena.hpl.hp.com/example#"), NodeFactory.createBlankNode()); Node l = NodeFactory.createLiteral( LiteralLabelFactory.createTypedLiteral(t) ); return env.bind(args[0], l); } }
private List<Triple> writeTriples(StreamRDF out, int size) { List<Triple> results = new ArrayList<>(); out.start(); for (int i = 1; i <= size; i++) { Triple t = new Triple(NodeFactory.createBlankNode(), NodeFactory.createURI("http://predicate"), NodeFactoryExtra.intToNode(i)); out.triple(t); results.add(t); } out.finish(); return results; }
@Override public boolean bodyCall(Node[] args, int length, RuleContext context) { checkArgs(length, context); BindingEnvironment env = context.getEnv(); Triple t = new Triple( NodeFactory.createBlankNode(), NodeFactory.createURI("http://jena.hpl.hp.com/example#"), NodeFactory.createBlankNode()); Node l = NodeFactory.createLiteral( LiteralLabelFactory.createTypedLiteral(t) ); return env.bind(args[0], l); } }
@Test public void deleteAny_01() { DatasetGraph dsg = emptyDataset() ; Node subject = NodeFactory.createURI("http://example/s"); Node predicate = NodeFactory.createURI("http://example/p"); Node object = NodeFactory.createBlankNode(); dsg.add(new Quad(Quad.defaultGraphIRI, subject, predicate, object)); dsg.deleteAny(Node.ANY, subject, null, null); }
@Override public void run() { out.start(); // Generate quads for (int i = 1; i <= generateSize; i++) { Quad q = new Quad(org.apache.jena.graph.NodeFactory.createURI("http://graph"), org.apache.jena.graph.NodeFactory.createBlankNode(), org.apache.jena.graph.NodeFactory.createURI("http://predicate"), NodeFactoryExtra.intToNode(i)); out.quad(q); } out.finish(); return; } };
public void testEquals() { assertDiffer( "different variables", NodeFactory.createVariable( "xx" ), NodeFactory.createVariable( "yy" ) ); assertEquals( "same vars", NodeFactory.createVariable( "aa" ), NodeFactory.createVariable( "aa" ) ); assertEquals( "same URI", NodeFactory.createURI( U ), NodeFactory.createURI( U ) ); assertEquals( "same anon", NodeFactory.createBlankNode( A ), NodeFactory.createBlankNode( A ) ); assertEquals( "same literal", NodeFactory.createLiteral( L ), NodeFactory.createLiteral( L ) ); assertFalse( "distinct URIs", NodeFactory.createURI( U ) == NodeFactory.createURI( U ) ); assertFalse( "distinct hyphens", NodeFactory.createBlankNode( A ) == NodeFactory.createBlankNode( A ) ); assertFalse( "distinct literals", NodeFactory.createLiteral( L ) == NodeFactory.createLiteral( L ) ); assertFalse( "distinct vars", NodeFactory.createVariable( "aa" ) == NodeFactory.createVariable( "aa" ) ); }
public void testEquals() { assertDiffer( "different variables", NodeFactory.createVariable( "xx" ), NodeFactory.createVariable( "yy" ) ); assertEquals( "same vars", NodeFactory.createVariable( "aa" ), NodeFactory.createVariable( "aa" ) ); assertEquals( "same URI", NodeFactory.createURI( U ), NodeFactory.createURI( U ) ); assertEquals( "same anon", NodeFactory.createBlankNode( A ), NodeFactory.createBlankNode( A ) ); assertEquals( "same literal", NodeFactory.createLiteral( L ), NodeFactory.createLiteral( L ) ); assertFalse( "distinct URIs", NodeFactory.createURI( U ) == NodeFactory.createURI( U ) ); assertFalse( "distinct hyphens", NodeFactory.createBlankNode( A ) == NodeFactory.createBlankNode( A ) ); assertFalse( "distinct literals", NodeFactory.createLiteral( L ) == NodeFactory.createLiteral( L ) ); assertFalse( "distinct vars", NodeFactory.createVariable( "aa" ) == NodeFactory.createVariable( "aa" ) ); }