/** * Gets NXRelations statement list corresponding to the Jena statement list. * * @param graph the jena graph * @param jenaStatements jena statements list * @return NXRelations statements list */ private List<Statement> getNXRelationsStatements(Model graph, List<com.hp.hpl.jena.rdf.model.Statement> jenaStatements) { List<Statement> nuxStmts = new ArrayList<Statement>(); for (com.hp.hpl.jena.rdf.model.Statement jenaStmt : jenaStatements) { // NXP-2665: remove reified statements are they're as properties in // nuxeo logic if (!jenaStmt.getSubject().canAs(ReifiedStatement.class)) { nuxStmts.add(getNXRelationsStatement(graph, jenaStmt)); } } return nuxStmts; }
private static AnyList convertList(Resource tso) { if (tso.canAs(RDFList.class)) { List<RDFNode> operand = tso.as(RDFList.class).asJavaList(); Any[] elements = new Any[operand.size()]; for (int i = 0; i < operand.size(); i += 1) elements[i] = RDFQ.any( operand.get(i) ); return RDFQ.list( elements ); } else { EldaException.BadSpecification( "Object " + tso + " of " + ELDA_API.textSearchOperand + " must be an RDF list." ); return /* never */ null; } }
/** Answer this view after modifying it to contain all the property chains defined by <code>spec</code>. */ public View addViewFromRDFList(Resource spec, ShortnameService sns) { cannotUpdateALL(); if (spec.canAs(RDFList.class)) { List<ViewProperty> properties = new ArrayList<>(); Iterator<RDFNode> list = spec.as(RDFList.class).iterator(); while(list.hasNext()) { properties.add(new ViewProperty.Base(list.next().as(Property.class))); } chains.add( new PropertyChain( properties ) ); } else { String uri = spec.asResource().getURI(); Property prop = ResourceFactory.createProperty(uri); ViewProperty vp = new ViewProperty.Base(prop); chains.add(new PropertyChain(vp)); } if (chains.size() > 0) type = Type.T_CHAINS; return this; }
if (obj.canAs( RDFList.class )) {
/** * Convert the given Jena Resource into a Sesame Resource * @param theRes the jena resource to convert * @return the jena resource as a sesame resource */ public static org.openrdf.model.Resource asSesameResource(Resource theRes) { if (theRes == null) { return null; } else if (theRes.canAs(Property.class)) { return asSesameURI(theRes.as(Property.class)); } else { return FACTORY.createURI("urn:anno4j:" + theRes.getId().getLabelString()); } }
/** * <p>Answer the class or datarnage to which all values of the restricted property belong.</p> * @return The ontology class of the restricted property values * @exception OntProfileException If the {@link Profile#HAS_CLASS_Q()} property is not supported in the current language profile. */ @Override public OntResource getHasClassQ() { checkProfile( getProfile().HAS_CLASS_Q(), "HAS_CLASS_Q" ); Resource r = getProperty( getProfile().HAS_CLASS_Q() ).getResource(); if (r.canAs( OntClass.class )) { return r.as( OntClass.class ); } else if (r.canAs( DataRange.class )) { return r.as( DataRange.class ); } else { return r.as( OntResource.class ); } }
o = new ObjectList(this); parseIntoCollection(r.as(Bag.class), (Collection)o, sType, pMeta); } else if (r.canAs(RDFList.class)) { o = new ObjectList(this); parseIntoCollection(r.as(RDFList.class), (Collection)o, sType, pMeta); } else if (isBag(r)) { parseIntoCollection(r.as(Bag.class), (Collection)o, sType, pMeta); } else if (r.canAs(RDFList.class)) { parseIntoCollection(r.as(RDFList.class), (Collection)o, sType, pMeta); } else {