@Override public boolean isValid(RDFNode node) { return node.isResource(); } @Override
/** Answer the resource at the end of the path, if defined, or null */ public Resource getTerminalResource() { RDFNode n = getTerminal(); return (n != null && n.isResource()) ? (Resource) n : null; } }
public static List<Resource> multiValueResource(Resource r, Property p) { List<RDFNode> nodes = multiValue(r, p) ; List<Resource> values = new ArrayList<Resource>() ; for ( Iterator<RDFNode> iter= nodes.iterator() ; iter.hasNext() ; ) { RDFNode n = iter.next(); if ( n.isResource() ) values.add((Resource)n) ; } return values ; }
public static List<Resource> multiValueResource(Resource r, Property p) { List<RDFNode> nodes = multiValue(r, p) ; List<Resource> values = new ArrayList<Resource>() ; for ( Iterator<RDFNode> iter= nodes.iterator() ; iter.hasNext() ; ) { RDFNode n = iter.next(); if ( n.isResource() ) values.add((Resource)n) ; } return values ; }
public boolean containsClass(RDFNode s) { return m_Classes.contains( s ) || (s.isResource() && m_Restrictions.contains( s )); }
/** Answer the given node presenting the OntResource facet if it can */ private static RDFNode asOntResource( RDFNode n ) { return n.isResource() ? n.as( OntResource.class ) : n; }
public boolean containsResource(RDFNode s) { return m_Ontologies.contains( s ) || m_Classes.contains( s ) || m_Datatypes.contains( s ) || m_Individuals.contains( s ) || m_AllRoles.contains( s ) || m_RDFClasses.contains( s ) || (s.isResource() && m_Restrictions.contains( s )) || m_Literals.contains( s ) || m_SWRLVariables.contains( s ); }
public boolean containsResource(RDFNode s) { return m_Ontologies.contains( s ) || m_Classes.contains( s ) || m_Datatypes.contains( s ) || m_Individuals.contains( s ) || m_AllRoles.contains( s ) || m_RDFClasses.contains( s ) || (s.isResource() && m_Restrictions.contains( s )) || m_Literals.contains( s ) || m_SWRLVariables.contains( s ); }
private boolean isSeq(RDFNode n) { if (n.isResource()) { Statement st = n.asResource().getProperty(pRdfType); if (st != null) return RDF_SEQ.equals(st.getResource().getURI()); } return false; }
private boolean isBag(RDFNode n) { if (n.isResource()) { Statement st = n.asResource().getProperty(pRdfType); if (st != null) return RDF_BAG.equals(st.getResource().getURI()); } return false; }
private void addViewPropertiesByResource( View v, List<RDFNode> items ) { ShortnameService sns = apiSpec.getShortnameService(); for (RDFNode pNode: items) { if (pNode.isResource()) { v.addViewFromRDFList((Resource)pNode, sns); } else EldaException.BadSpecification( "object of api:property is a literal: " + pNode ); } }
public boolean selects(Statement s) { if (s.getObject().isResource()) { Resource res = s.getObject().asResource(); return res.equals(FOAF.Organization); } else { return false; } } };
public boolean selects(Statement s) { if (s.getObject().isResource()) { return s.getObject().asResource() .equals(SKOS.CONCEPTSCHEME); } else { return false; } } };
public void addViewers(Resource root, Map<String, View> views) { Model m = root.getModel(); for (NodeIterator ni = m.listObjectsOfProperty( root, API.viewer ); ni.hasNext();) { RDFNode tNode = ni.next(); if (!tNode.isResource()) throw new APIException("Found literal " + tNode + " when expecting a view resource"); View v = getView( (Resource) tNode ); views.put( v.name(), v ); explicitViewNames.add( v.name() ); } }
private RDFNode expand(Bindings b, RDFNode O) { if (O.isResource()) return O; String lex = O.asNode().getLiteralLexicalForm(); String typeURI = O.asNode().getLiteralDatatypeURI(); String expanded = b.expandVariables(lex); if (RDFS_Resource.equals(typeURI)) return ResourceFactory.createResource(expanded); return litModel.createTypedLiteral(expanded, typeURI); } }
private String asBody( RDFNode n ) { if (n.isLiteral()) return n.asLiteral().getLexicalForm(); if (n.isResource()) return n.asResource().getURI(); return n.toString(); }
/** Convert a model to a set of nodes with edges to other nodes */ void convert(Model m) { for (StmtIterator it = m.listStatements(); it.hasNext();) { Statement s = it.next(); RDFNode o = s.getObject(); if (o.isResource()) convert(s.getSubject(), o.asResource()); } }
public static String getAsStringValue(Resource r, Property p) { if ( ! atmostOneProperty(r, p) ) throw new NotUniqueException(r, p) ; Statement s = r.getProperty(p) ; if ( s == null ) return null ; if ( s.getObject().isResource() ) return s.getResource().getURI() ; return s.getString() ; }
public static String getAsStringValue(Resource r, Property p) { if ( ! atmostOneProperty(r, p) ) throw new NotUniqueException(r, p) ; Statement s = r.getProperty(p) ; if ( s == null ) return null ; if ( s.getObject().isResource() ) return s.getResource().getURI() ; return s.getString() ; }
public boolean selects(Statement s) { if (s.getObject().isResource() && !s.getSubject().hasProperty(RDF.type, OWL.Class) && !s.getSubject().hasProperty(RDF.type, OWL.ObjectProperty) && !s.getSubject().hasProperty(RDF.type, OWL.DatatypeProperty)) { return s.getObject().asResource().equals(resource); } else { return false; } } };