Package pellet4topbraid.sm

Source Code of pellet4topbraid.sm.ApplyPelletModule

/*
* This file is part of the pellet4topbraid project.
* Homepage:  http://code.google.com/p/pellet4topbraid/
*
*/

package pellet4topbraid.sm;

import org.mindswap.pellet.jena.PelletReasonerFactory;
import org.topbraid.base.progress.ProgressMonitor;
import org.topbraid.spin.sparqlmotion.modules.AbstractSMModule;
import org.topbraid.spin.sparqlmotion.modules.SMException;

import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.reasoner.Reasoner;


/**
* A SPARQLMotion module that applies Pellet on the input graph.
*/
public class ApplyPelletModule extends AbstractSMModule {

  @Override
  protected Graph createGraph(ProgressMonitor monitor) throws SMException {
    // Get RDF graph from predecessor modules
    Model inputModel = getRDFInputModel( monitor );
   
    // Wrap this input graph with Pellet
    Reasoner reasoner = PelletReasonerFactory.theInstance().create();
    return ModelFactory.createInfModel( reasoner, inputModel ).getGraph();
  }
}
TOP

Related Classes of pellet4topbraid.sm.ApplyPelletModule

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.