Search in sources :

Example 1 with MappingDocumentBuilder

use of nl.knaw.huygens.timbuctoo.rml.rmldata.builders.MappingDocumentBuilder in project timbuctoo by HuygensING.

the class JenaBasedReader method fromRdf.

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);
}
Also used : ResIterator(org.apache.jena.rdf.model.ResIterator) RdfResource(nl.knaw.huygens.timbuctoo.rml.rdfshim.RdfResource) Resource(org.apache.jena.rdf.model.Resource) MappingDocumentBuilder(nl.knaw.huygens.timbuctoo.rml.rmldata.builders.MappingDocumentBuilder)

Aggregations

RdfResource (nl.knaw.huygens.timbuctoo.rml.rdfshim.RdfResource)1 MappingDocumentBuilder (nl.knaw.huygens.timbuctoo.rml.rmldata.builders.MappingDocumentBuilder)1 ResIterator (org.apache.jena.rdf.model.ResIterator)1 Resource (org.apache.jena.rdf.model.Resource)1