Refine search
@Override public void removeFromPrefixMap(String graphName, String prefix) { Node g = NodeFactory.createURI(graphName) ; Node p = NodeFactory.createLiteral(prefix) ; removeAll(g, p, null) ; }
@Test(expected=ExprEvalException.class) public void testRDFtermEquals3() { // Unextended - no language tag Node n1 = NodeFactory.createLiteral("xyz") ; Node n2 = NodeFactory.createLiteral("xyz", "en") ; NodeFunctions.rdfTermEquals(n1, n2) ; }
@Test public void testSameTerm3() { Node n1 = NodeFactory.createLiteral("xyz") ; Node n2 = NodeFactory.createURI("xyz") ; assertFalse(NodeFunctions.sameTerm(n1, n2)) ; }
/** * Tests that xsd:time is typed as Time * @throws SQLException */ @Test public void test_column_type_detection_datetimes_04() throws SQLException { testColumnTypeDetection("x", NodeFactory.createLiteral("13:15:00.123", XSDDatatype.XSDtime), true, Types.TIME, Time.class.getCanonicalName()); }
@Test public void testRDFtermEquals1() { Node n1 = NodeFactory.createURI("xyz") ; Node n2 = NodeFactory.createLiteral("xyz") ; assertFalse(NodeFunctions.rdfTermEquals(n1, n2)) ; }
@Override public synchronized void insertPrefix(String graphName, String prefix, String uri) { Node g = NodeFactory.createURI(graphName) ; Node p = NodeFactory.createLiteral(prefix) ; Node u = NodeFactory.createURI(uri) ; nodeTupleTable.addRow(g,p,u) ; }
/** * Test that xsd:string literals are typed as strings * @throws SQLException */ @Test public void test_column_type_detection_strings_03() throws SQLException { testColumnTypeDetection("x", NodeFactory.createLiteral("simple", XSDDatatype.XSDstring), true, Types.NVARCHAR, String.class.getCanonicalName()); }
@Test public void test_param_string_positional_3() { // Test regular string injection String cmdText = "SELECT * WHERE { ? ? ? . }"; ParameterizedSparqlString query = new ParameterizedSparqlString(cmdText); query.setParam(0, NodeFactory.createLiteral("with ? mark")); query.setParam(1, NodeFactory.createURI("http://predicate")); query.setParam(2, NodeFactory.createLiteral("test")); Assert.assertEquals("SELECT * WHERE { \"with ? mark\" <http://predicate> \"test\" . }", query.toString()); }
@Override public void removeFromPrefixMap(String graphName, String prefix) { Node g = NodeFactory.createURI(graphName) ; Node p = NodeFactory.createLiteral(prefix) ; removeAll(g, p, null) ; }
@Test public void testSameTerm1() { Node n1 = NodeFactory.createLiteral("xyz") ; Node n2 = NodeFactory.createLiteral("xyz") ; assertTrue(NodeFunctions.sameTerm(n1, n2)) ; }
@Test public void distinct_triples_01() throws IOException { MapReduceDriver<LongWritable, TripleWritable, TripleWritable, NullWritable, NullWritable, TripleWritable> driver = this .getMapReduceDriver(); Triple t = new Triple(NodeFactory.createURI("urn:s"), NodeFactory.createURI("urn:p"), NodeFactory.createLiteral("1")); TripleWritable tw = new TripleWritable(t); driver.addInput(new LongWritable(1), tw); driver.addOutput(NullWritable.get(), tw); driver.runTest(); }
@Override public void insertPrefix(String graphName, String prefix, String uri) { Node g = NodeFactory.createURI(graphName) ; Node p = NodeFactory.createLiteral(prefix) ; Node u = NodeFactory.createURI(uri) ; nodeTupleTable.addRow(g,p,u) ; }
@Test public void testSameTerm6() { Node n1 = NodeFactory.createLiteral("xyz", "en") ; Node n2 = NodeFactory.createLiteral("xyz", "EN") ; assertTrue(NodeFunctions.sameTerm(n1, n2)) ; }
@Test public void rdfjson_escapes() { Graph g = GraphFactory.createGraphMem(); Node s = NodeFactory.createBlankNode(); Node p = NodeFactory.createURI("http://predicate"); g.add(new Triple(s, p, NodeFactory.createLiteral("quote \" character"))); g.add(new Triple(s, p, NodeFactory.createLiteral("new \n\r lines"))); g.add(new Triple(s, p, NodeFactory.createLiteral("tab \t character"))); test(g); }
private Triple getTriple2() { Node n1 = NodeFactory.createURI("nb1") ; Node n2 = NodeFactory.createURI("nb2") ; Node l3 = NodeFactory.createLiteral("lb3") ; return new Triple(n1, n2, l3) ; }
@Test public void testRDFtermEquals2() { Node n1 = NodeFactory.createLiteral("xyz", "en") ; Node n2 = NodeFactory.createLiteral("xyz", "EN") ; assertTrue(NodeFunctions.rdfTermEquals(n1, n2)) ; }
@Test public void testNotEquals3() { // Literals and URIs are different. NodeValue nv1 = NodeValue.makeNode(org.apache.jena.graph.NodeFactory.createURI("http://example")); NodeValue nv2 = NodeValue.makeNode(org.apache.jena.graph.NodeFactory.createLiteral("http://example")); assertFalse("NodeValue.equals()", nv1.equals(nv2)); } }
private Triple getPrefixedTriple() { Node n1 = aUriRemappableNode() ; Node n2 = NodeFactory.createURI("n2") ; Node l3 = NodeFactory.createLiteral("l3") ; return new Triple(n1, n2, l3) ; }
/** * Expect xsd:boolean to be typed as booleans * @throws SQLException */ @Test public void test_column_type_detection_boolean() throws SQLException { testColumnTypeDetection("x", NodeFactory.createLiteral("true", XSDDatatype.XSDboolean), true, Types.BOOLEAN, Boolean.class.getCanonicalName()); }
@Test public void test_param_string_positional_7() { // Test regular string injection String cmdText = "SELECT * WHERE { ? ? ?, ?o . }"; ParameterizedSparqlString query = new ParameterizedSparqlString(cmdText); query.setParam(0, NodeFactory.createURI("http://example.org")); query.setParam(1, NodeFactory.createURI("http://predicate")); query.setParam(2, NodeFactory.createLiteral("test")); Assert.assertEquals("SELECT * WHERE { <http://example.org> <http://predicate> \"test\", ?o . }", query.toString()); }