/** * Return the uri of the datatype of the literal. This will be null in the * case of plain literals. */ @Override public String getDatatypeURI() { return asNode().getLiteralDatatypeURI(); }
/** * Return the uri of the datatype of the literal. This will be null in the * case of plain literals. */ @Override public String getDatatypeURI() { return asNode().getLiteralDatatypeURI(); }
/** * Gets whether a node has a numeric datatype * * @param n * Node * @return True if a numeric datatype, false otherwise */ private static boolean hasNumericDatatype(Node n) { if (n == null) return false; if (!n.isLiteral()) return false; return numericTypes.contains(n.getLiteralDatatypeURI()); } }
/** * Gets whether a node has a numeric datatype * * @param n * Node * @return True if a numeric datatype, false otherwise */ private static boolean hasNumericDatatype(Node n) { if (n == null) return false; if (!n.isLiteral()) return false; return numericTypes.contains(n.getLiteralDatatypeURI()); } }
private boolean objectIsPersonName(Triple triple) { return Objects.equals(triple.getObject().getLiteralDatatypeURI(), TIM_PERSON_NAME_TYPE); }
public String getDatatypeURI() { return asNode().getLiteralDatatypeURI() ; }
public JSNamedNode getDatatype() { String uri = node.getLiteralDatatypeURI(); return new JSNamedNode(NodeFactory.createURI(uri)); }
public JSNamedNode getDatatype() { String uri = node.getLiteralDatatypeURI(); return new JSNamedNode(NodeFactory.createURI(uri)); }
@Override public boolean canMap(Node node) { boolean result = node.isURI() || (node.isLiteral() && XSD.xstring.toString().equals(node.getLiteralDatatypeURI())); return result; }
protected Expr asExprNoSign(Node n) { String lex = n.getLiteralLexicalForm() ; String lang = n.getLiteralLanguage() ; String dtURI = n.getLiteralDatatypeURI() ; n = createLiteral(lex, lang, dtURI) ; return ExprUtils.nodeToExpr(n) ; }
public static Node datatype(Node node) { if ( !node.isLiteral() ) { NodeValue.raise(new ExprTypeException("datatype: Not a literal: " + node)) ; return null ; } String s = node.getLiteralDatatypeURI() ; boolean plainLiteral = (s == null || s.equals("")) ; if ( plainLiteral ) { boolean simpleLiteral = (node.getLiteralLanguage() == null || node.getLiteralLanguage().equals("")) ; if ( !simpleLiteral ) return NodeConst.rdfLangString ; return XSD.xstring.asNode() ; } return NodeFactory.createURI(s) ; }
@Override protected NodeWritable[] getNodes(QuadWritable tuple) { Node object = tuple.get().getObject(); if (!object.isLiteral()) return EMPTY; String dtUri = object.getLiteralDatatypeURI(); if (dtUri == null) return EMPTY; return new NodeWritable[] { new NodeWritable(NodeFactory.createURI(dtUri)) }; } }
@Override protected NodeWritable[] getNodes(TripleWritable tuple) { Node object = tuple.get().getObject(); if (!object.isLiteral()) return EMPTY; String dtUri = object.getLiteralDatatypeURI(); if (dtUri == null) return EMPTY; return new NodeWritable[] { new NodeWritable(NodeFactory.createURI(dtUri)) }; } }
private void testTypeExpandsPrefix( String type ) { Node n = NodeCreateUtils.create( "'stuff'" + type ); String wanted = PrefixMapping.Extended.expandPrefix( type ); assertEquals( wanted, n.getLiteralDatatypeURI() ); }
private void testTypeExpandsPrefix( String type ) { Node n = NodeCreateUtils.create( "'stuff'" + type ); String wanted = PrefixMapping.Extended.expandPrefix( type ); assertEquals( wanted, n.getLiteralDatatypeURI() ); }
public void testCreateTypedLiteralBoolean() { Node n = NodeCreateUtils.create( "\"true\"xsd:boolean" ); assertEquals( "true", n.getLiteralLexicalForm() ); assertEquals( "", n.getLiteralLanguage() ); assertEquals( expand( "xsd:boolean" ), n.getLiteralDatatypeURI() ); }
public void testCreateTypedLiteralInteger() { Node n = NodeCreateUtils.create( "'42'xsd:integer" ); assertEquals( "42", n.getLiteralLexicalForm() ); assertEquals( "", n.getLiteralLanguage() ); assertEquals( expand( "xsd:integer" ), n.getLiteralDatatypeURI() ); }
public void testCreateTypedLiteralInteger() { Node n = NodeCreateUtils.create( "'42'xsd:integer" ); assertEquals( "42", n.getLiteralLexicalForm() ); assertEquals( "", n.getLiteralLanguage() ); assertEquals( expand( "xsd:integer" ), n.getLiteralDatatypeURI() ); }
public void testCreateTypedLiteralBoolean() { Node n = NodeCreateUtils.create( "\"true\"xsd:boolean" ); assertEquals( "true", n.getLiteralLexicalForm() ); assertEquals( "", n.getLiteralLanguage() ); assertEquals( expand( "xsd:boolean" ), n.getLiteralDatatypeURI() ); }
public static void setHash(Hash h, Node n) { if ( n.isURI() ) hash(h, n.getURI(), null, null, URI); else if ( n.isBlank() ) hash(h, n.getBlankNodeLabel(), null, null, BNODE); else if ( n.isLiteral() ) { String dt = n.getLiteralDatatypeURI(); if ( NodeUtils.isSimpleString(n) || NodeUtils.isLangString(n) ) { // RDF 1.1 : No datatype for: // xsd:String as simple literals // rdf:langString and @ dt = null; } hash(h, n.getLiteralLexicalForm(), n.getLiteralLanguage(), dt, LITERAL); } else throw new TDBException("Attempt to hash something strange: " + n); }