private Iterator<Triple> asTriples( StmtIterator it ) { return it.mapWith( mapAsTriple ); }
public SpecCommon(Resource root) { this.root = root; for (RDFNode x: root.listProperties(ELDA_API.license).mapWith(Statement.Util.getObject).toList()) { licences.add(x); } }
/** Answer the list of sources that may be used to enhance the view of the selected items. Always contains at least the given source. */ private List<Source> extractDescribeSources( FileManager fm, AuthMap am, Resource specification, Source dataSource ) { List<Source> result = new ArrayList<Source>(); result.add( dataSource ); result.addAll( specification.listProperties( ELDA_API.enhanceViewWith ).mapWith( toSource( fm, am ) ).toList() ); return result; }
protected static RDFNode getUnique( Resource root, Property property ) { List<RDFNode> nodes = root.listProperties( property ) .mapWith( getObject ).toList(); if (nodes.size() == 0) return null; if (nodes.size() == 1) return nodes.get(0); throw new NotUniqueException( root, property ); }
public Set<Resource> getNotices() { Set<Resource> result = new HashSet<Resource>(); for (RDFNode x: root.listProperties(ELDA_API.notice).mapWith(Statement.Util.getObject).toList()) { result.add(x.asResource()); } return result; } }
private static Set<Resource> subjectSet( Model result, Resource S, Property P, RDFNode O ) { return result.listStatements( S, P, O ) .mapWith( Statement.Util.getSubject ).toSet(); }
private List<RDFNode> getEntryAuthors(Resource r) { for (Property p: getAuthorProperties()) { List<RDFNode> candidates = r.listProperties(p).mapWith(Statement.Util.getObject).toList(); if (candidates.size() > 0) return candidates; } return new ArrayList<RDFNode>(); }
public Set<Resource> implementsTypes() { return implementTypes.listStatements().mapWith( Statement.Util.getSubject ).toSet(); } }
/** ep is a resource of type Combiner. It has multiple elements, each of which themselves represent sub-sources. */ public CombinedSource( FileManager fm, AuthMap am, Resource ep ) { constructs = ep.listProperties( ELDA_API.construct ).mapWith( toString ).toList(); matches = ep.listProperties( ELDA_API.match ).mapWith( toString ).toList(); sources = ep.listProperties( ELDA_API.element ).mapWith( toSource( fm, am ) ).toList(); }
private static List<RDFNode> formattersOf( Resource endpoint ) { return endpoint.listProperties( API.formatter ).mapWith( Statement.Util.getObject ).toList(); }
public static void addLoadedFrom( Model m, String name ) { List<Statement> toAdd = new ArrayList<Statement>(); List<Resource> apis = m .listStatements( null, RDF.type, API.API ) .mapWith(Statement.Util.getSubject) .toList() ; for (Resource api: apis) toAdd.add( m.createStatement( api, ELDA_API.loadedFrom, name ) ); m.add( toAdd ); }
protected Set<Couple<String, Resource>> allFiltersOf( Set<Couple<String, Resource>> them, Resource sel) { for (RDFNode p: sel.listProperties( API.parent ).mapWith( Statement.Util.getObject ).toList()) { allFiltersOf( them, (Resource) p ); } for (RDFNode f: sel.listProperties( API.filter ).mapWith( Statement.Util.getObject).toList()) { String pvs = ((Literal) f).getLexicalForm(); for (String filter: pvs.split( "&" )) them.add( new Couple<String, Resource>( filter, sel ) ); } return them; }
private void addPropertyValues( Trail t, Element e, Resource x, Property p ) { Element pe = createElement(p); e.appendChild( pe ); Set<RDFNode> values = x.listProperties( p ).mapWith( Statement.Util.getObject ).toSet(); // if (values.size() > 1 || isMultiValued( p )) { for (RDFNode value: sortObjects( p, values )) { appendValueAsItem(t, pe, value); } } else if (values.size() == 1) { giveValueToElement( t, pe, values.iterator().next() ); } }
private static Resource getRendererType( Resource r ) { for (RDFNode tn: r.listProperties( RDF.type ).mapWith( Statement.Util.getObject ).toList()) { Resource t = tn.asResource(); if (BuiltinRendererTable.isRendererType( t )) return t; } return 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( new ObjectAsOntResourceMapper() ), null ); }
public void renderMetadata(Element e, Resource x, Resource xInMetaModel) { Set<Resource> cyclic = CycleFinder.findCycles( xInMetaModel ); Set<Resource> blocked = new HashSet<Resource>(); Set<Resource> seen = new HashSet<Resource>(); Trail t = new Trail( cyclic, seen, blocked ); // blocked.add( x ); Statement emv = xInMetaModel.getProperty( API.extendedMetadataVersion ); if (emv != null) blocked.add( emv.getResource() ); // addIdentification( t, e, x ); List<Property> metaProperties = asSortedList( xInMetaModel.listProperties().mapWith( Statement.Util.getPredicate ).toSet() ); // if (suppressIPTO) properties.remove( FOAF.isPrimaryTopicOf ); for (Property p: metaProperties) addPropertyValues( t, e, xInMetaModel, p ); }
public void expandProperties(Trail t, Element pt, Resource anItem) { List<Property> properties = asSortedList( anItem.listProperties().mapWith( Statement.Util.getPredicate ).toSet() ); for (Property ip: properties) addPropertyValues( t, pt, anItem, ip ); }
/** * <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( new SubjectAsMapper<OntProperty>( OntProperty.class ) ); }
/** Add properties to the view, setting the property chains and possibly the labelled-describe label property URI. */ private View addViewProperties( Model m, Set<Resource> seen, Resource tRes, View v ) { setDescribeLabelIfPresent( tRes, v ); addViewPropertiesByString( v, m.listObjectsOfProperty( tRes, API.properties ).toList() ); addViewPropertiesByResource( v, m.listObjectsOfProperty( tRes, API.property ).toList() ); for (RDFNode n: tRes.listProperties( API.include ).mapWith( Statement.Util.getObject ).toList()) { if (n.isResource() && seen.add( (Resource) n )) addViewProperties( m, seen, (Resource) n, v ); } return v; }
private void extractDatatypes( Model m ) { List<Resource> dataTypes = m.listStatements( null, RDF.type, RDFS.Datatype ).mapWith( Statement.Util.getSubject ).toList(); for (Resource t: dataTypes) declareDatatype( t.getURI() ); for (Resource p: m.listSubjectsWithProperty( RDF.type, OWL.DatatypeProperty ).toList()) { for (RDFNode t: m.listObjectsOfProperty( p, RDFS.range ).toList()) { declareDatatype( t.asResource().getURI() ); } } }