@Override public Bag getBag() { return object.as( Bag.class ); }
/** 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 static List<Resource> extractTasks(Collection<Resource> testSuites) { List<Resource> testCases = testSuites.stream() .flatMap(testSuite -> testSuite.getProperty(SparqlQcVocab.hasTest).getObject().as(RDFList.class) .asJavaList().stream().map(RDFNode::asResource)) .filter(task -> !task.hasProperty(RDF.type, SparqlQcVocab.WarmupContainmentTest)) .collect(Collectors.toList()); return testCases; }
/** * <p>Answer an iterator over all of the classes that are the operands of this * Boolean class expression. Each element of the iterator will be an {@link OntClass}.</p> * @return An iterator over the operands of the expression. * @exception ProfileException If the operand property is not supported in the current language profile. */ @Override public ExtendedIterator<? extends OntClass> listOperands() { return getOperands().iterator().mapWith( n -> n.as( OntClass.class ) ); }
public static <T extends RDFNode> T rdfNode( final Model m, final String s, final Class<T> c ) { return ModelTestBase.rdfNode(m, s).as(c); }
/** * <p>Answer an iterator over all of the individuals that are declared to be the class extension for * this class. Each element of the iterator will be an {@link OntResource}.</p> * @return An iterator over the individuals in the class extension * @exception ProfileException If the {@link Profile#ONE_OF()} property is not supported in the current language profile. */ @Override public ExtendedIterator<? extends OntResource> listOneOf() { return getOneOf().iterator().mapWith( n -> n.as( OntResource.class ) ); }
/** Answer the object of a statement with the given property, .as() the given class */ protected <T extends RDFNode> T objectAs( Property p, String name, Class<T> asClass ) { checkProfile( p, name ); try { return getRequiredProperty( p ).getObject().as( asClass ); } catch (PropertyNotFoundException e) { return null; } }
/** * <p>Answer an iterator over all of the literals that are declared to be the permissible values for * this class. Each element of the iterator will be an {@link Literal}.</p> * @return An iterator over the literals that are the permissible values * @exception ProfileException If the {@link Profile#ONE_OF()} property is not supported in the current language profile. */ @Override public ExtendedIterator<Literal> listOneOf() { return getOneOf().iterator().mapWith( n -> n.as( Literal.class ) ); }
/** * <p>Answer an iterator over all of the literals that are declared to be the permissible values for * this class. Each element of the iterator will be an {@link Literal}.</p> * @return An iterator over the literals that are the permissible values * @exception ProfileException If the {@link Profile#ONE_OF()} property is not supported in the current language profile. */ @Override public ExtendedIterator<Literal> listOneOf() { return getOneOf().iterator().mapWith( n -> n.as( Literal.class ) ); }
public static Literal literal( final Model m, final String s ) { return ModelTestBase.rdfNode(m, s).as(Literal.class); }
/** Answer the object of a statement with the given property, .as() the given class */ protected <T extends RDFNode> T objectAs( Property p, String name, Class<T> asClass ) { checkProfile( p, name ); try { return getRequiredProperty( p ).getObject().as( asClass ); } catch (PropertyNotFoundException e) { return null; } }
/** * <p>Answer an iterator over all of the classes that are the operands of this * Boolean class expression. Each element of the iterator will be an {@link OntClass}.</p> * @return An iterator over the operands of the expression. * @exception ProfileException If the operand property is not supported in the current language profile. */ @Override public ExtendedIterator<? extends OntClass> listOperands() { return getOperands().iterator().mapWith( n -> n.as( OntClass.class ) ); }
public static <T extends RDFNode> T rdfNode( final Model m, final String s, final Class<T> c ) { return ModelTestBase.rdfNode(m, s).as(c); }
/** * <p>Answer an iterator over all of the individuals that are declared to be the class extension for * this class. Each element of the iterator will be an {@link OntResource}.</p> * @return An iterator over the individuals in the class extension * @exception ProfileException If the {@link Profile#ONE_OF()} property is not supported in the current language profile. */ @Override public ExtendedIterator<? extends OntResource> listOneOf() { return getOneOf().iterator().mapWith( n -> n.as( OntResource.class ) ); }
public static Property property( final Model m, final String s ) { return ModelTestBase.rdfNode(m, s).as(Property.class); }
/** If _n_ is a ReifiedStatement, create a local copy of it, which will force the underlying reifier to take note of the mapping. */ private void noteIfReified( RDFNode n ) { if (n.canAs( ReifiedStatement.class )) { ReifiedStatement rs = n.as( ReifiedStatement.class ); createReifiedStatement( rs.getURI(), rs.getStatement() ); } }
/** If _n_ is a ReifiedStatement, create a local copy of it, which will force the underlying reifier to take note of the mapping. */ private void noteIfReified( RDFNode n ) { if (n.canAs( ReifiedStatement.class )) { ReifiedStatement rs = n.as( ReifiedStatement.class ); createReifiedStatement( rs.getURI(), rs.getStatement() ); } }
/** Answer an iterator for the given property, whose values are .as() some class */ protected <T extends RDFNode> ExtendedIterator<T> listAs( Property p, String name, Class<T> cls ) { checkProfile( p, name ); return WrappedIterator.create( listProperties( p ) ).mapWith( s -> s.getObject().as( cls ) ); }
/** Answer an iterator for the given property, whose values are .as() some class */ protected <T extends RDFNode> ExtendedIterator<T> listAs( Property p, String name, Class<T> cls ) { checkProfile( p, name ); return WrappedIterator.create( listProperties( p ) ).mapWith( s -> s.getObject().as( cls ) ); }
@Override public SecuredRDFList getTail() throws ReadDeniedException, AuthenticationRequiredException { checkRead(); Statement s = holder.getBaseItem().getRequiredProperty(listRest()); checkRead(s); return SecuredRDFListImpl.getInstance(getModel(), s.getObject().as(RDFList.class)); }