protected void checkAdd(final int pos, final Literal literal) throws AddDeniedException, UpdateDeniedException, AuthenticationRequiredException { checkAdd(pos, literal.asNode()); }
/** * Convert a URI string to an RDF node * * @param r the uri string * @return RDF node representation of the given string */ public Node asLiteralStringNode(final String r) { return ResourceFactory.createPlainLiteral(r).asNode(); }
/** * Test that two literals are semantically equivalent. * In some cases this may be the same as equals, in others * equals is stricter. For example, two xsd:int literals with * the same value but different language tag are semantically * equivalent but distinguished by the java equality function * in order to support round tripping. */ @Override public boolean sameValueAs(Literal other) { return asNode().sameValueAs(other.asNode()); }
/** * Test that two literals are semantically equivalent. * In some cases this may be the same as equals, in others * equals is stricter. For example, two xsd:int literals with * the same value but different language tag are semantically * equivalent but distinguished by the java equality function * in order to support round tripping. */ @Override public boolean sameValueAs(Literal other) { return asNode().sameValueAs(other.asNode()); }
@Override protected NodeValue exec(Node arg1, FunctionEnv env) { return NodeValue.makeBoolean(env.getActiveGraph().contains(arg1, SH.deactivated.asNode(), JenaDatatypes.TRUE.asNode())); } }
@Override protected NodeValue exec(Node arg1, FunctionEnv env) { return NodeValue.makeBoolean(env.getActiveGraph().contains(arg1, SH.deactivated.asNode(), JenaDatatypes.TRUE.asNode())); } }
private static String literalToString(Literal l) { StringWriterI sw = new StringWriterI(); NodeFormatter fmt = new NodeFormatterTTL(null, null); fmt.formatLiteral(sw, l.asNode()); return sw.toString(); }
/** * Tests that xsd:dateTime is typed as Date * @throws SQLException */ @Test public void test_column_type_detection_datetimes_01() throws SQLException { Model m = ModelFactory.createDefaultModel(); testColumnTypeDetection("x", m.createTypedLiteral(Calendar.getInstance()).asNode(), true, Types.TIMESTAMP, Timestamp.class.getCanonicalName()); }
private void initFromShape(Node shape, Graph graph) { if(!graph.contains(shape, SH.deactivated.asNode(), JenaDatatypes.TRUE.asNode())) { initFromShape(shape, SH.property.asNode(), graph); initFromShape(shape, SH.parameter.asNode(), graph); } }
public void testIsValidLiteral1() { Literal lit = m.createTypedLiteral("100", XSDDatatype.XSD+"#anyType") ; assertFalse(XSDDatatype.XSDinteger.isValidLiteral(lit.asNode().getLiteral())); } public void testIsValidLiteral2()
public void testIsValidLiteral2() { Literal lit = m.createTypedLiteral("100", XSDDatatype.XSD+"#anySimpleType") ; assertFalse(XSDDatatype.XSDinteger.isValidLiteral(lit.asNode().getLiteral())); }
public void testIsValidLiteral2() { Literal lit = m.createTypedLiteral("100", XSDDatatype.XSD+"#anySimpleType") ; assertFalse(XSDDatatype.XSDinteger.isValidLiteral(lit.asNode().getLiteral())); }
public void testIsValidLiteral1() { Literal lit = m.createTypedLiteral("100", XSDDatatype.XSD+"#anyType") ; assertFalse(XSDDatatype.XSDinteger.isValidLiteral(lit.asNode().getLiteral())); } public void testIsValidLiteral2()
@Override public String getString(final int index) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final String retval = holder.getBaseItem().getString(index); checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index) .asNode(), ResourceFactory.createTypedLiteral(retval).asNode())); return retval; }
@Override public short getShort(final int index) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final short retval = holder.getBaseItem().getShort(index); checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index) .asNode(), ResourceFactory.createTypedLiteral(retval).asNode())); return retval; }
@Override public String getLanguage(final int index) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final Literal literal = holder.getBaseItem().getLiteral(index); checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index) .asNode(), literal.asNode())); return literal.getLanguage(); }
@Override public SecuredLiteral getLiteral(final int index) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final Literal literal = holder.getBaseItem().getLiteral(index); checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index) .asNode(), literal.asNode())); return SecuredLiteralImpl.getInstance(getModel(), literal); }
public void testBinary2() { // Check round tripping from value LiteralLabel l2 = m.createTypedLiteral("DCpj", XSDDatatype.XSDbase64Binary).asNode().getLiteral(); Object data2 = l2.getValue(); assertTrue("binary test 3", data2 instanceof byte[]); byte[] data2b = (byte[])data2; assertEquals("binary test 4", data2b[0], data[0]); assertEquals("binary test 5", data2b[1], data[1]); assertEquals("binary test 6", data2b[2], data[2]); }
public void testBinary2() { // Check round tripping from value LiteralLabel l2 = m.createTypedLiteral("DCpj", XSDDatatype.XSDbase64Binary).asNode().getLiteral(); Object data2 = l2.getValue(); assertTrue("binary test 3", data2 instanceof byte[]); byte[] data2b = (byte[])data2; assertEquals("binary test 4", data2b[0], data[0]); assertEquals("binary test 5", data2b[1], data[1]); assertEquals("binary test 6", data2b[2], data[2]); }
@Test public void test_param_string_constructor_6() { // Test constructor with predefined parameters QuerySolutionMap map = new QuerySolutionMap(); Resource r = ResourceFactory.createResource("http://example.org"); map.add("s", r); Literal l = ResourceFactory.createPlainLiteral("example"); map.add("o", l); ParameterizedSparqlString query = new ParameterizedSparqlString("", map); Assert.assertEquals(r.asNode(), query.getParam("s")); Assert.assertEquals(l.asNode(), query.getParam("o")); }