public static List<String> multiValueString(Resource r, Property p) { List<RDFNode> nodes = multiValue(r, p) ; List<String> values = new ArrayList<>() ; for ( RDFNode n : nodes ) { if ( n.isLiteral() ) { values.add(((Literal)n).getString()) ; } } return values ; }
/** Answer the resource that is the object of the statement <code>s</code>. If the object is not a resource, throw a BadObjectException with that statement. */ public static Resource getResource( Statement s ) { RDFNode ob = s.getObject(); if (ob.isLiteral()) throw new BadObjectException( s ); return (Resource) ob; }
private static String getStringValue(Statement stmt) { if (stmt == null) { return null; } else { RDFNode node = stmt.getObject(); if (node.isLiteral()) { return ((Literal) node).getLexicalForm(); } else { return null; } } }
/** Answer the resource that is the object of the statement <code>s</code>. If the object is not a resource, throw a BadObjectException with that statement. */ public static Resource getResource( Statement s ) { RDFNode ob = s.getObject(); if (ob.isLiteral()) throw new BadObjectException( s ); return (Resource) ob; }
/** Answer a URL string from a resource or literal */ protected String getURL( RDFNode n ) { return n.isLiteral() ? ((Literal) n).getLexicalForm() : ((Resource) n).getURI(); }
public Object getLastValue() { if (lastValue != null && lastValue.isLiteral()) { return ((Literal)lastValue).getLexicalForm(); } else { return lastValue; } }
public Object getLastValue() { if (lastValue != null && lastValue.isLiteral()) { return ((Literal)lastValue).getLexicalForm(); } else { return lastValue; } }
public String getNodeLabel(RDFNode node) { if(node.isLiteral()) { return node.asNode().getLiteralLexicalForm(); } else { return getLabel((Resource)node); } }
public static boolean getBooleanProperty(Resource subject, Property predicate) { Statement s = subject.getProperty(predicate); if(s != null && s.getObject().isLiteral()) { return s.getBoolean(); } else { return false; } }
public static Double getDoubleProperty(Resource subject, Property predicate) { Statement s = subject.getProperty(predicate); if(s != null && s.getObject().isLiteral()) { return s.getDouble(); } else { return null; } }
public static List<Literal> getLiteralProperties(Resource subject, Property predicate) { List<Literal> results = new LinkedList<>(); StmtIterator it = subject.listProperties(predicate); while(it.hasNext()) { Statement s = it.next(); if(s.getObject().isLiteral()) { results.add(s.getLiteral()); } } return results; }
public static String getStringProperty(Resource subject, Property predicate) { Statement s = subject.getProperty(predicate); if(s != null && s.getObject().isLiteral()) { return s.getString(); } else { return null; } }
public static boolean getBooleanProperty(Resource subject, Property predicate) { Statement s = subject.getProperty(predicate); if(s != null && s.getObject().isLiteral()) { return s.getBoolean(); } else { return false; } }
/** * Answer the string value of the parameter if set, or null otherwise. Note command line * has precedence. * * @return String */ protected String getStringValue( List<String> cmdLineArgs, Resource confRoot ) { RDFNode n = getValue( cmdLineArgs, confRoot ); return (n == null) ? null : (n.isLiteral() ? n.asLiteral().getLexicalForm() : n.toString() ); }
@Override public boolean test( Statement x ) { RDFNode o = x.getObject(); return o.isLiteral() && langTagMatch( m_lang, o.asLiteral().getLanguage() ); } }
@Override public boolean test( Statement x ) { RDFNode o = x.getObject(); return o.isLiteral() && langTagMatch( m_lang, o.asLiteral().getLanguage() ); } }
public Double getOrder() { Statement s = shape.getProperty(SH.order); if(s != null && s.getObject().isLiteral()) { return s.getLiteral().getDouble(); } else { return 0.0; } }
private static String stringValue(RDFNode n) { if (n.isResource()) { return n.asResource().getURI(); } else if (n.isLiteral()) { return n.asLiteral().getValue().toString(); } return n.toString(); }
private String getObjectURI( Statement s ) { RDFNode ob = s.getObject(); if (ob.isLiteral()) return AssemblerHelp.getString( s ); if (ob.isAnon()) throw new BadObjectException( s ); return ((Resource) ob).getURI(); }
private String getObjectURI( Statement s ) { RDFNode ob = s.getObject(); if (ob.isLiteral()) return AssemblerHelp.getString( s ); if (ob.isAnon()) throw new BadObjectException( s ); return ((Resource) ob).getURI(); }