All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mindswap.pellet.jena.JenaLoader Maven / Gradle / Ivy

There is a newer version: 2.3.6-ansell
Show newest version
// Copyright (c) 2006 - 2008, Clark & Parsia, LLC. 
// This source code is available under the terms of the Affero General Public
// License v3.
//
// Please see LICENSE.txt for full license terms, including the availability of
// proprietary exceptions.
// Questions, comments, or requests for clarification: [email protected]

package org.mindswap.pellet.jena;

import org.mindswap.pellet.KBLoader;
import org.mindswap.pellet.KnowledgeBase;

import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.util.FileManager;

/**
 * 

* Title: *

*

* Description: *

*

* Copyright: Copyright (c) 2007 *

*

* Company: Clark & Parsia, LLC. *

* * @author Evren Sirin */ public class JenaLoader extends KBLoader { private static final FileManager manager = FileManager.get(); private OntModel model; private PelletInfGraph pellet; public JenaLoader() { clear(); } public PelletInfGraph getGraph() { return pellet; } /** * {@inheritDoc} */ @Override public KnowledgeBase getKB() { return pellet.getKB(); } public OntModel getModel() { return model; } /** * {@inheritDoc} */ @Override public void load() { pellet.prepare( false ); } /** * {@inheritDoc} */ @Override protected void parseFile(String file) { manager.readModel( model, file, inputFormat ); } /** * {@inheritDoc} */ @Override public void clear() { if( model != null ) model.close(); model = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC ); pellet = (PelletInfGraph) model.getGraph(); } /** * Used for the Jena loader * * @param inputFormat */ public void setInputFormat(String inputFormat) { this.inputFormat = inputFormat.toUpperCase(); } /** * {@inheritDoc} */ @Override public void setIgnoreImports(boolean ignoreImports) { model.getDocumentManager().setProcessImports( !ignoreImports ); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy