Java Code Examples for org.apache.jena.rdf.model.ResIterator#nextResource()
The following examples show how to use
org.apache.jena.rdf.model.ResIterator#nextResource() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModelWrapper.java From FCA-Map with GNU General Public License v3.0 | 6 votes |
private void acquireInstances() { // XXX: remove instances of DBkWik:Image and SKOS:Concept, Template. Under consideration. ResIterator it = null; if (m_inferred) { it = m_inferred_model.listSubjects(); } else { it = m_raw_model.listSubjects(); } while (it.hasNext()) { Resource r = it.nextResource(); if (DBkWik.ownAsResource(r) && !DBkWik.ownAsTemplate(r) && !r.hasProperty(RDF.type, SKOS.Concept) && !r.hasProperty(RDF.type, DBkWik.Image)) { m_instances.add(r); } } }
Example 2
Source File: SolidContactsExport.java From data-transfer-project with Apache License 2.0 | 6 votes |
private List<VCard> parseAddressBook(Resource selfResource, SolidUtilities utilities) throws IOException { String peopleUri = selfResource.getProperty(NAME_EMAIL_INDEX_PROPERTY).getResource().getURI(); Model peopleModel = utilities.getModel(peopleUri); List<VCard> vcards = new ArrayList<>(); ResIterator subjects = peopleModel.listSubjects(); while (subjects.hasNext()) { Resource subject = subjects.nextResource(); Model personModel = utilities.getModel(subject.getURI()); Resource personResource = SolidUtilities.getResource(subject.getURI(), personModel); if (personResource == null) { throw new IllegalStateException(subject.getURI() + " not found in " + subject.toString()); } vcards.add(parsePerson(personResource)); } return vcards; }
Example 3
Source File: ModelWrapper.java From FCA-Map with GNU General Public License v3.0 | 5 votes |
private Set<Resource> acquireResources(ResIterator it) { Set<Resource> resources = new HashSet<>(); while (it.hasNext()) { Resource r = it.nextResource(); resources.add(r); } return resources; }
Example 4
Source File: JenaBasedReader.java From timbuctoo with GNU General Public License v3.0 | 5 votes |
public RmlMappingDocument fromRdf(Model data, Function<RdfResource, Optional<DataSource>> dataSourceFactory) { ResIterator tripleMaps = data.listSubjectsWithProperty(data.createProperty(NS_RR + "subjectMap")); MappingDocumentBuilder resultBuilder = rmlMappingDocument(); try { while (tripleMaps.hasNext()) { Resource resource = tripleMaps.nextResource(); buildTripleMap(JenaResource.fromModel(data, resource), resultBuilder.withTripleMap(resource.getURI())); } } finally { tripleMaps.close(); } return resultBuilder.build(dataSourceFactory); }