public static ExtendedIterator<Resource> listReversePropertyValues(Resource s, Property p) { ExtendedIterator<Resource> result = listReverseProperties(s, p) .mapWith(Statement::getSubject); return result; }
public static ExtendedIterator<RDFNode> listPropertyValues(Resource s, Property p) { ExtendedIterator<RDFNode> result = listProperties(s, p) .mapWith(Statement::getObject); return result; }
private Iterator<Triple> asTriples( StmtIterator it ) { return it.mapWith( s -> s.asTriple() ); }
private Iterator<Triple> asTriples( StmtIterator it ) { return it.mapWith( s -> s.asTriple() ); }
public Set<Resource> implementsTypes() { return implementTypes.listStatements().mapWith( Statement::getSubject ).toSet(); } }
protected static RDFNode getUnique( Resource root, Property property ) { List<RDFNode> nodes = root.listProperties( property ) .mapWith( s -> s.getObject() ).toList(); if (nodes.size() == 0) return null; if (nodes.size() == 1) return nodes.get(0); throw new NotUniqueException( root, property ); }
private static Set<Resource> subjectSet( Model result, Resource S, Property P, RDFNode O ) { return result.listStatements( S, P, O ) .mapWith( Statement::getSubject ).toSet(); }
protected static RDFNode getUnique( Resource root, Property property ) { List<RDFNode> nodes = root.listProperties( property ) .mapWith( s -> s.getObject() ).toList(); if (nodes.size() == 0) return null; if (nodes.size() == 1) return nodes.get(0); throw new NotUniqueException( root, property ); }
private static Set<Resource> subjectSet( Model result, Resource S, Property P, RDFNode O ) { return result.listStatements( S, P, O ) .mapWith( Statement::getSubject ).toSet(); }
public Set<Resource> implementsTypes() { return implementTypes.listStatements().mapWith( Statement::getSubject ).toSet(); } }
private List<Statement> copyProperties( Resource root, Function<Statement, Statement> replace, Property property ) { return root.listProperties( property ).mapWith( replace ).toList(); }
private List<Statement> copyProperties( Resource root, Function<Statement, Statement> replace, Property property ) { return root.listProperties( property ).mapWith( replace ).toList(); }
@Override public ExtendedIterator<Quad> getQuads() { return model.listStatements().mapWith( stmt -> new Quad( defaultGraphName, stmt.asTriple() ) ); }
@Override public ExtendedIterator<Quad> getQuads() { return model.listStatements().mapWith( stmt -> new Quad( defaultGraphName, stmt.asTriple() ) ); }
/** * <p>Answer an iterator over the set of all values for a given RDF property. Each * value in the iterator will be an RDFNode, representing the value (object) of * each statement in the underlying model.</p> * * @param property The property whose values are sought * @return An Iterator over the values of the property */ @Override public NodeIterator listPropertyValues( Property property ) { return new NodeIteratorImpl( listProperties( property ).mapWith( s -> asOntResource( s.getObject() ) ), null ); }
/** * <p>Answer an iterator over the set of all values for a given RDF property. Each * value in the iterator will be an RDFNode, representing the value (object) of * each statement in the underlying model.</p> * * @param property The property whose values are sought * @return An Iterator over the values of the property */ @Override public NodeIterator listPropertyValues( Property property ) { return new NodeIteratorImpl( listProperties( property ).mapWith( s -> asOntResource( s.getObject() ) ), null ); }
/** Write classes as vanilla RDF terms */ protected void writeRDFClasses() { String template = m_options.hasClassTemplateOption() ? m_options.getClassTemplateOption() : DEFAULT_TEMPLATE; // make sure we're looking for the appropriate type of class Resource cls = OWL.Class; if (m_options.hasLangRdfsOption()) { cls = RDFS.Class; } // collect the classes to list List<Resource> classes = m_source.listStatements( null, RDF.type, cls ).mapWith( s -> s.getSubject()).toList(); for (Iterator<? extends RDFNode> i = sorted( classes ); i.hasNext(); ) { writeValue( (Resource) i.next(), template, "Resource", "createResource", "_CLASS" ); } }
/** Write classes as vanilla RDF terms */ protected void writeRDFClasses() { String template = m_options.hasClassTemplateOption() ? m_options.getClassTemplateOption() : DEFAULT_TEMPLATE; // make sure we're looking for the appropriate type of class Resource cls = OWL.Class; if (m_options.hasLangRdfsOption()) { cls = RDFS.Class; } // collect the classes to list List<Resource> classes = m_source.listStatements( null, RDF.type, cls ).mapWith( s -> s.getSubject()).toList(); for (Iterator<? extends RDFNode> i = sorted( classes ); i.hasNext(); ) { writeValue( (Resource) i.next(), template, "Resource", "createResource", "_CLASS" ); } }
/** * <p>Answer an iterator over the properties that are defined to be inverses of this property.</p> * @return An iterator over the properties that declare themselves the <code>inverseOf</code> this property. */ @Override public ExtendedIterator<OntProperty> listInverse() { return getModel().listStatements( null, getProfile().INVERSE_OF(), this ).mapWith( s -> s.getSubject().as( OntProperty.class ) ); }
/** * <p>Answer an iterator over the properties that are defined to be inverses of this property.</p> * @return An iterator over the properties that declare themselves the <code>inverseOf</code> this property. */ @Override public ExtendedIterator<OntProperty> listInverse() { return getModel().listStatements( null, getProfile().INVERSE_OF(), this ).mapWith( s -> s.getSubject().as( OntProperty.class ) ); }