@Override public String getTypeUri() { return this.literal.getDatatypeURI(); } }
public boolean isDouble(){ try{ return l.getDatatypeURI() != null && l.getDatatypeURI().contains("double"); }catch (Exception e) { return false; } }
public boolean isFloat(){ try{ return l.getDatatypeURI() != null && l.getDatatypeURI().contains("float"); }catch (Exception e) { return false; } }
public boolean isBoolean(){ try{ return l.getDatatypeURI() != null && l.getDatatypeURI().contains("boolean"); }catch (Exception e) { return false; } }
public boolean isInt(){ try{ return l.getDatatypeURI() != null && l.getDatatypeURI().contains("int"); }catch (Exception e) { return false; } }
/** Return true if the literal is a simple string. * <p>RDF 1.0 {@literal =>} it is a plain literal, with no language tag * <p>RDF 1.1 {@literal =>} it has datatype xsd:string */ public static boolean isSimpleString(Literal lit) { Objects.requireNonNull(lit) ; String dtStr = lit.getDatatypeURI() ; if ( dtStr == null ) return ! isLangString(lit) ; if ( JenaRuntime.isRDF11 ) return dtStr.equals(XSDDatatype.XSDstring.getURI()); return false ; }
/** Return true if the literal is a simple string. * <p>RDF 1.0 {@literal =>} it is a plain literal, with no language tag * <p>RDF 1.1 {@literal =>} it has datatype xsd:string */ public static boolean isSimpleString(Literal lit) { Objects.requireNonNull(lit) ; String dtStr = lit.getDatatypeURI() ; if ( dtStr == null ) return ! isLangString(lit) ; if ( JenaRuntime.isRDF11 ) return dtStr.equals(XSDDatatype.XSDstring.getURI()); return false ; }
/** * Return the uri of the datatype of the literal. This will be null in the * case of plain literals. */ @Override public String getDatatypeURI() throws ReadDeniedException, AuthenticationRequiredException { checkRead(); return holder.getBaseItem().getDatatypeURI(); }
private String getFilter(String varName, Set<Literal> literals){ String filter = "FILTER("; Literal min = getMin(literals); filter += varName + ">=\"" + min.getLexicalForm() + "\"^^<" + min.getDatatypeURI() + ">"; filter += " && "; Literal max = getMax(literals); filter += varName + "<=\"" + max.getLexicalForm() + "\"^^<" + min.getDatatypeURI() + ">"; filter += ")"; return filter; }
private OWLLiteral asOWLLiteral(OWLDataFactory df, Literal literal){ OWLLiteral owlLiteral; if(literal.getDatatypeURI() == null){ owlLiteral = df.getOWLLiteral(literal.getLexicalForm(), literal.getLanguage()); } else { owlLiteral = df.getOWLLiteral(literal.getLexicalForm(), df.getOWLDatatype(IRI.create(literal.getDatatypeURI()))); } return owlLiteral; }
private OWLLiteral asOWLLiteral(OWLDataFactory df, Literal literal){ OWLLiteral owlLiteral; if(literal.getDatatypeURI() == null){ owlLiteral = df.getOWLLiteral(literal.getLexicalForm(), literal.getLanguage()); } else { owlLiteral = df.getOWLLiteral(literal.getLexicalForm(), df.getOWLDatatype(IRI.create(literal.getDatatypeURI()))); } return owlLiteral; }
protected DataPropertyStatement fillDataPropertyStatementWithJenaLiteral(DataPropertyStatement dataPropertyStatement, Literal l) { dataPropertyStatement.setData(l.getLexicalForm()); dataPropertyStatement.setDatatypeURI(l.getDatatypeURI()); dataPropertyStatement.setLanguage(l.getLanguage()); return dataPropertyStatement; }
@SuppressWarnings("unused") private SerialisableResource(Resource resource){ super(); this.isURI = resource.isURIResource(); this.isBlank = resource.isAnon(); this.isLiteral = resource.isLiteral(); this._resource = resource.toString(); if (this.isLiteral) literalDataType = resource.asLiteral().getDatatypeURI(); }
private DataPropertyStatement makeStatement() { DataPropertyStatement dps = new DataPropertyStatementImpl(subjectUri, property.getURI(), literalValue.getLexicalForm()); // Language and datatype are needed to get the correct hash value dps.setLanguage(literalValue.getLanguage()); dps.setDatatypeURI(literalValue.getDatatypeURI()); return dps; }
private DataPropertyStatement makeStatement(Literal literalValue) { DataPropertyStatement dps = new DataPropertyStatementImpl(subjectUri, property.getURI(), literalValue.getLexicalForm()); // Language and datatype are needed to get the correct hash value dps.setLanguage(literalValue.getLanguage()); dps.setDatatypeURI(literalValue.getDatatypeURI()); return dps; }
public void testCreateTypedLiteral() { final Literal l = ResourceFactory.createTypedLiteral("22", XSDDatatype.XSDinteger); Assert.assertTrue(l.getLexicalForm().equals("22")); Assert.assertTrue(l.getLanguage().equals("")); Assert.assertTrue(l.getDatatype() == XSDDatatype.XSDinteger); Assert.assertTrue(l.getDatatypeURI().equals( XSDDatatype.XSDinteger.getURI())); }
public void testCreateTypedLiteral() { final Literal l = ResourceFactory.createTypedLiteral("22", XSDDatatype.XSDinteger); Assert.assertTrue(l.getLexicalForm().equals("22")); Assert.assertTrue(l.getLanguage().equals("")); Assert.assertTrue(l.getDatatype() == XSDDatatype.XSDinteger); Assert.assertTrue(l.getDatatypeURI().equals( XSDDatatype.XSDinteger.getURI())); }
public void testCreateLiteral() { final Literal l = ResourceFactory.createPlainLiteral("lex"); Assert.assertTrue(l.getLexicalForm().equals("lex")); Assert.assertTrue(l.getLanguage().equals("")); Assert.assertNull(l.getDatatype()); Assert.assertNull(l.getDatatypeURI()); }
public void testCreateLiteral() { final Literal l = ResourceFactory.createPlainLiteral("lex"); Assert.assertTrue(l.getLexicalForm().equals("lex")); Assert.assertTrue(l.getLanguage().equals("")); Assert.assertNull(l.getDatatype()); Assert.assertNull(l.getDatatypeURI()); }
private static DataPropertyStatement makeDataPropertyStatementFromStatement(Statement statement, RDFNode node) { Literal lit = (Literal) node.as(Literal.class); String value = lit.getLexicalForm(); String lang = lit.getLanguage(); String datatypeUri = lit.getDatatypeURI(); DataPropertyStatement dps = new DataPropertyStatementImpl(); dps.setDatatypeURI(datatypeUri); dps.setLanguage(lang); dps.setData(value); dps.setDatapropURI(statement.getPredicate().getURI()); dps.setIndividualURI(statement.getSubject().getURI()); return dps; }