Java Code Examples for com.hp.hpl.jena.rdf.model.ResIterator#next()

The following examples show how to use com.hp.hpl.jena.rdf.model.ResIterator#next() . 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: DatasetDescriptionServlet.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
private static Set<Resource> generatePartitions(Model m, Resource type,
		Property p) {
	Set<Resource> partitions = new HashSet<Resource>();
	ResIterator classIt = m.listResourcesWithProperty(RDF.type, type);
	while (classIt.hasNext()) {
		Resource classMap = classIt.next();
		StmtIterator pIt = classMap.listProperties(p);
		while (pIt.hasNext()) {
			partitions.add((Resource) pIt.next().getObject());
		}
	}
	return partitions;
}
 
Example 2
Source File: R2RMLReader.java    From GeoTriples with Apache License 2.0 5 votes vote down vote up
private void checkForSpuriousTypes() {
	// This doesn't catch spurious subclass triples, e.g., rr:SubjectMap,
	// rr:R2RMLView.
	for (ComponentType type: ComponentType.values()) {
		ResIterator it = model.listResourcesWithProperty(RDF.type, type.asResource());
		while (it.hasNext()) {
			Resource r = it.next();
			if (mapping.getMappingComponent(r, type) == null) {
				report.report(Problem.SPURIOUS_TYPE, r, RDF.type, type.asResource());
			}
		}
	}
	remainingTriples.removeAll(null, RDF.type, (RDFNode) null);
}
 
Example 3
Source File: Entity.java    From xcurator with Apache License 2.0 5 votes vote down vote up
public static Set<Resource> getAllEntitiesOfType(Model model, String type) {
    Set<Resource> ret = new HashSet<Resource>();

    ResIterator list = model.listSubjectsWithProperty(RDF.type, model.createResource(type));
    while (list.hasNext()) {
        Resource entity = list.next();
        ret.add(entity);
    }

    return ret;
}
 
Example 4
Source File: ConfigurationBean.java    From LodView with MIT License 5 votes vote down vote up
private Map<String, String> populateColorPairMatcher() {
	Map<String, String> result = new HashMap<String, String>();
	ResIterator iter = confModel.listSubjectsWithProperty(confModel.createProperty(confModel.getNsPrefixURI("conf"), "hasColorPair"));
	while (iter.hasNext()) {
		Resource res = iter.next();
		NodeIterator values = confModel.listObjectsOfProperty(res, confModel.createProperty(confModel.getNsPrefixURI("conf"), "hasColorPair"));
		while (values.hasNext()) {
			RDFNode node = values.next();
			result.put(res.toString(), node.toString());
			break;
		}
	}
	return result;
}