Java Code Examples for com.hp.hpl.jena.rdf.model.ModelFactory#createInfModel()

The following examples show how to use com.hp.hpl.jena.rdf.model.ModelFactory#createInfModel() . 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: Validator.java    From aliada-tool with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Validates the collected sample.
 * 
 * @param resource the Job resource representation (i.e. the sample owner).
 * @param exchange the current exchange.
 */
public void validate(final JobResource resource, final Exchange exchange) {
	log.info(MessageCatalog._00055_VALIDATING, resource.getID());

	resource.markAsValidated();

	collectSample(resource.getID(), exchange.getIn().getBody(String.class));
	
	final InfModel infmodel = ModelFactory.createInfModel(reasoner, samples.remove(resource.getID()));
       final ValidityReport validity = infmodel.validate();
       if (!validity.isClean()) {
       	log.info(MessageCatalog._00057_VALIDATION_KO, resource.getID());
       	for (final Iterator<ValidityReport.Report> iterator = validity.getReports(); iterator.hasNext(); ) {
       		final ValidityReport.Report report = iterator.next();
       		validationMessageRepository.save(new ValidationMessage(resource.getID(), report.getType(), report.getDescription()));
        	log.info(MessageCatalog._00058_VALIDATION_MSG, resource.getID(), report.getDescription(), report.getType());
       	}
        resource.setRunning(false);
        exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE); 
       } else {
        log.info(MessageCatalog._00056_VALIDATION_OK, resource.getID());
       }		
}
 
Example 2
Source File: ModelImplJena.java    From semweb4j with BSD 2-Clause "Simplified" License 5 votes vote down vote up
void applyReasoning(Reasoning r) {
	switch(r) {
	case rdfs:
		this.jenaModel = ModelFactory.createRDFSModel(this.jenaModel);
		break;
	case owl:
		this.jenaModel = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(),
		        this.jenaModel);
		break;
	default:
		break;
	}
}