Protégé-OWL 3.3.1

edu.stanford.smi.protegex.owl.jena.parser
Class ProtegeOWLParser

java.lang.Object
  extended by edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser

public class ProtegeOWLParser
extends Object

An OWL parser that reads an OWL stream triple-by-triple and writes the corresponding Protege-OWL Triples into one or more TripleStores. The current implementation uses the Jena ARP parser for triple loading.

Author:
Holger Knublauch , Matthew Horridge

Nested Class Summary
static interface ProtegeOWLParser.ARPInvokation
          An interface needed as an abstraction of the various methods to invoke the Jena ARP (the various load methods with different parameters).
 
Constructor Summary
ProtegeOWLParser(OWLModel owlModel, boolean incremental)
           
 
Method Summary
static void addImport(JenaOWLModel owlModel, URI ontologyName)
          A convenience method that dynamically adds an import to a JenaOWLModel.
static void addImport(JenaOWLModel owlModel, URI ontologyName, String prefixForDefaultNamespace)
          A convenience method that dynamically adds an import to a JenaOWLModel.
protected  com.hp.hpl.jena.rdf.arp.ARP createARP()
           
protected  ProtegeOWLParserLogger createLogger()
           
protected  OWLModelPatcher createPatcher()
           
protected  URI2NameConverter createURI2NameConverter(OWLModel owlModel, boolean incremental)
           
static Collection getErrors()
           
static URI getErrorURI()
          Gets the ontology name of the most recently parsed file.
protected  String getImplicitImport(String namespace)
           
static InputStream getInputStream(URL url)
           
protected  ProtegeOWLParserLogger getLogger()
           
 void loadTriples(TripleStore tripleStore, String ontologyName, ProtegeOWLParser.ARPInvokation invokation)
           
 void run(InputStream is, String xmlBase)
          This method loads an ontology from the specified input stream using the specified base uri.
 void run(Reader reader, String xmlBase)
          This method loads an ontology using the specified Reader and using the specified base uri.
protected  void run(String uri, ProtegeOWLParser.ARPInvokation invokation)
           
 void run(URI uri)
          This method loads an ontology pointed to by the specified URI.
 void setImporting(boolean importing)
           
 void setLogger(ProtegeOWLParserLogger logger)
           
static void setUnresolvedImportHandler(UnresolvedImportHandler handler)
           
 void setURI2NameConverter(URI2NameConverter converter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtegeOWLParser

public ProtegeOWLParser(OWLModel owlModel,
                        boolean incremental)
Method Detail

setImporting

public void setImporting(boolean importing)

run

public void run(URI uri)
         throws Exception
This method loads an ontology pointed to by the specified URI.

Parameters:
uri - The URI that points to the ontology.
Throws:
Exception

run

public void run(InputStream is,
                String xmlBase)
         throws Exception
This method loads an ontology from the specified input stream using the specified base uri.

Parameters:
is -
xmlBase - The XML base to use when loading the ontology. This is typically the URI from where the ontology was loaded.
Throws:
Exception

run

public void run(Reader reader,
                String xmlBase)
         throws Exception
This method loads an ontology using the specified Reader and using the specified base uri. Note that the preferred method of loading an ontology is to use the run method that takes an InputStream as a parameter rather than a Reader.

Parameters:
reader - The reader used to read the ontology
xmlBase - The XML base to use when loading the ontology. This is typically the URI from where the ontology was loaded.
Throws:
Exception

run

protected void run(String uri,
                   ProtegeOWLParser.ARPInvokation invokation)
            throws Exception
Throws:
Exception

loadTriples

public void loadTriples(TripleStore tripleStore,
                        String ontologyName,
                        ProtegeOWLParser.ARPInvokation invokation)
                 throws Exception
Throws:
Exception

setUnresolvedImportHandler

public static void setUnresolvedImportHandler(UnresolvedImportHandler handler)

createARP

protected com.hp.hpl.jena.rdf.arp.ARP createARP()

createLogger

protected ProtegeOWLParserLogger createLogger()

createPatcher

protected OWLModelPatcher createPatcher()

createURI2NameConverter

protected URI2NameConverter createURI2NameConverter(OWLModel owlModel,
                                                    boolean incremental)

getErrorURI

public static URI getErrorURI()
Gets the ontology name of the most recently parsed file. This can be used to diagnose where an exception has occured.

Returns:
the error ontology URI or null

getImplicitImport

protected String getImplicitImport(String namespace)

getLogger

protected ProtegeOWLParserLogger getLogger()

setLogger

public void setLogger(ProtegeOWLParserLogger logger)

setURI2NameConverter

public void setURI2NameConverter(URI2NameConverter converter)

getErrors

public static Collection getErrors()

addImport

public static void addImport(JenaOWLModel owlModel,
                             URI ontologyName)
                      throws Exception
A convenience method that dynamically adds an import to a JenaOWLModel. This will immediately load the file into a new TripleStore. Prior to invoking this method, the caller should define a prefix for the expected namespace (e.g., URI + "#"). Following the call, the caller should add an import statement to an existing OWLOntology (usually the default ontology). Note that the preferred method of adding imports is to use the ImportHelper, since this takes care of "house keeping" tasks that this "raw" addImport method does not.

Parameters:
owlModel -
ontologyName - The name of the imported ontology.
Throws:
Exception

addImport

public static void addImport(JenaOWLModel owlModel,
                             URI ontologyName,
                             String prefixForDefaultNamespace)
                      throws Exception
A convenience method that dynamically adds an import to a JenaOWLModel. This will immediately load the file into a new TripleStore. Following the call, the caller should add an import statement to an existing OWLOntology (usually the default ontology). Note that the preferred method of adding imports is to use the ImportHelper, since this takes care of "house keeping" tasks that this "raw" addImport method does not.

Parameters:
owlModel -
ontologyName -
prefixForDefaultNamespace - an (optional) prefix that shall be used for the the default namespace of the directly imported ontology
Throws:
Exception

getInputStream

public static InputStream getInputStream(URL url)
                                  throws IOException
Throws:
IOException

Protégé-OWL 3.3.1

Submit a bug report or feature request
Copyright (c) 1998-2007 Stanford University.