|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser
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.
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). |
private class |
ProtegeOWLParser.MyErrorHandler
|
private class |
ProtegeOWLParser.MyNamespaceHandler
|
private class |
ProtegeOWLParser.MyStatementHandler
|
Field Summary | |
private int |
count
|
private String |
currentDefaultNamespace
The default namespace to use if the current file does not define one by itself. |
private edu.stanford.smi.protege.model.Frame |
currentType
|
private static int |
errorLineNumber
|
private static URI |
errorURI
|
static boolean |
inUI
A rather ugly flag that can be activated to prompt the user if a local file was found as a possible import redirection. |
private boolean |
isRDFList
|
private edu.stanford.smi.protege.model.KnowledgeBase |
kb
|
private ProtegeOWLParserLogger |
logger
|
private OWLModel |
owlModel
|
private edu.stanford.smi.protege.model.Cls |
owlNamedClassClass
|
private OWLModelPatcher |
patcher
|
private String |
prefixForDefaultNamespace
|
private RDFProperty |
rdfFirstProperty
|
private RDFProperty |
rdfRestProperty
|
private static String |
RDFS_RESOURCE_URI
|
private RDFProperty |
rdfTypeProperty
|
private TripleStore |
tripleStore
|
private TripleStoreModel |
tripleStoreModel
|
private Collection |
tripleStores
|
private static UnresolvedImportHandler |
unresolvedImportHandler
|
private Map |
untypedResources
|
private URI2NameConverter |
uri2NameConverter
|
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. |
private void |
addNamespaceToImports(String defaultNamespace,
Set imports)
|
protected com.hp.hpl.jena.rdf.arp.ARP |
createARP()
|
private void |
createDefaultNamespace(TripleStore tripleStore)
|
private Object |
createLiteralObject(com.hp.hpl.jena.rdf.arp.ALiteral node,
RDFProperty property)
|
protected ProtegeOWLParserLogger |
createLogger()
|
protected OWLModelPatcher |
createPatcher()
|
private RDFResource |
createRDFResource(String name)
|
private RDFSLiteral |
createRDFSLiteral(com.hp.hpl.jena.rdf.arp.ALiteral literal,
RDFProperty property)
|
protected URI2NameConverter |
createURI2NameConverter(OWLModel owlModel,
boolean incremental)
|
private RDFResource |
findResource(String name)
|
static int |
getErrorLineNumber()
|
static URI |
getErrorURI()
Gets the URI of the most recently parsed file. |
protected String |
getImplicitImport(String namespace)
|
static InputStream |
getInputStream(URL url)
|
protected ProtegeOWLParserLogger |
getLogger()
|
private RDFProperty |
getRDFProperty(com.hp.hpl.jena.rdf.arp.AResource propertyNode)
|
private RDFResource |
getRDFResource(com.hp.hpl.jena.rdf.arp.AResource aResource)
|
private static Repository |
getRepository(OWLModel owlModel,
TripleStore tripleStore,
URI ontologyName)
|
private Collection |
getUntypedResources()
Gets all RDFResources that don't have any rdf:type. |
void |
loadTriples(InputStream is,
String xmlBase,
TripleStore tripleStore)
|
private void |
populateUntypedResourcesMap()
|
private void |
replaceNamespace(TripleStore tripleStore,
RDFResource ontology,
String prefix,
String namespace)
|
private void |
replaceTemporaryName(TripleStore tripleStore,
RDFResource resource,
String name,
boolean isOntology)
|
private void |
replaceTemporaryNames()
|
private void |
replaceTemporaryNames(TripleStore tripleStore)
|
void |
run(InputStream is,
String uri)
|
void |
run(Reader reader,
String uri)
|
void |
run(TripleStore tripleStore,
String ontologyName,
ProtegeOWLParser.ARPInvokation invokation)
|
void |
run(URI uri)
|
void |
run(URI uri,
String defaultNamespace,
TripleStore tripleStore)
Deprecated. |
void |
run(URI uri,
TripleStore tripleStore)
|
private boolean |
runImplicitImport(RDFResource resource,
Set imports,
Collection untypedResources)
|
private boolean |
runImplicitImports(Set imports)
Applies some heuristics to resolve missing owl:imports, especially for RDF Schema files. |
private void |
runImport(String uri,
Set imports)
Imports the ontology that has the name specified by uri . |
private void |
runImports(TripleStore tripleStore,
Set imports)
Imports the ontologies that are objects of any owl:imports triples in the specified TripleStore . |
void |
setLogger(ProtegeOWLParserLogger logger)
|
private void |
setPrefixForDefaultNamespace(String prefixForDefaultNamespace)
|
static void |
setUnresolvedImportHandler(UnresolvedImportHandler handler)
|
void |
setURI2NameConverter(URI2NameConverter converter)
|
void |
setURLResolver(URIResolver urlResolver)
Deprecated. This method no longer does anything. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int count
private String currentDefaultNamespace
private edu.stanford.smi.protege.model.Frame currentType
private static int errorLineNumber
private static URI errorURI
public static boolean inUI
private boolean isRDFList
private edu.stanford.smi.protege.model.KnowledgeBase kb
private ProtegeOWLParserLogger logger
private edu.stanford.smi.protege.model.Cls owlNamedClassClass
private OWLModel owlModel
private OWLModelPatcher patcher
private String prefixForDefaultNamespace
private RDFProperty rdfFirstProperty
private RDFProperty rdfRestProperty
private static final String RDFS_RESOURCE_URI
private RDFProperty rdfTypeProperty
private TripleStore tripleStore
private TripleStoreModel tripleStoreModel
private Collection tripleStores
private Map untypedResources
private URI2NameConverter uri2NameConverter
private static UnresolvedImportHandler unresolvedImportHandler
Constructor Detail |
public ProtegeOWLParser(OWLModel owlModel, boolean incremental)
Method Detail |
public static void setUnresolvedImportHandler(UnresolvedImportHandler handler)
private void addNamespaceToImports(String defaultNamespace, Set imports)
public static void addImport(JenaOWLModel owlModel, URI ontologyName) throws Exception
owlModel
- ontologyName
- The name of the imported ontology.
Exception
public static void addImport(JenaOWLModel owlModel, URI ontologyName, String prefixForDefaultNamespace) throws Exception
owlModel
- ontologyName
- prefixForDefaultNamespace
- an (optional) prefix that shall be used for the
the default namespace of the directly imported ontology
Exception
private static Repository getRepository(OWLModel owlModel, TripleStore tripleStore, URI ontologyName)
protected com.hp.hpl.jena.rdf.arp.ARP createARP()
private void createDefaultNamespace(TripleStore tripleStore)
private Object createLiteralObject(com.hp.hpl.jena.rdf.arp.ALiteral node, RDFProperty property)
protected ProtegeOWLParserLogger createLogger()
protected OWLModelPatcher createPatcher()
private RDFSLiteral createRDFSLiteral(com.hp.hpl.jena.rdf.arp.ALiteral literal, RDFProperty property)
private RDFResource createRDFResource(String name)
protected URI2NameConverter createURI2NameConverter(OWLModel owlModel, boolean incremental)
public static int getErrorLineNumber()
public static URI getErrorURI()
private RDFResource findResource(String name)
protected String getImplicitImport(String namespace)
protected ProtegeOWLParserLogger getLogger()
private RDFProperty getRDFProperty(com.hp.hpl.jena.rdf.arp.AResource propertyNode)
private RDFResource getRDFResource(com.hp.hpl.jena.rdf.arp.AResource aResource)
private Collection getUntypedResources()
private void populateUntypedResourcesMap()
private void replaceNamespace(TripleStore tripleStore, RDFResource ontology, String prefix, String namespace)
private void replaceTemporaryNames()
private void replaceTemporaryNames(TripleStore tripleStore)
private void replaceTemporaryName(TripleStore tripleStore, RDFResource resource, String name, boolean isOntology)
public void run(URI uri, TripleStore tripleStore) throws Exception
Exception
public void loadTriples(InputStream is, String xmlBase, TripleStore tripleStore) throws Exception
Exception
public void run(URI uri, String defaultNamespace, TripleStore tripleStore) throws Exception
Exception
public void run(TripleStore tripleStore, String ontologyName, ProtegeOWLParser.ARPInvokation invokation) throws Exception
Exception
private boolean runImplicitImports(Set imports) throws IOException, SAXException
IOException
SAXException
private boolean runImplicitImport(RDFResource resource, Set imports, Collection untypedResources) throws SAXException, IOException
SAXException
IOException
private void runImports(TripleStore tripleStore, Set imports) throws SAXException, IOException
TripleStore
. Ontologies that have already
been imported will not be imported again.
SAXException
IOException
private void runImport(String uri, Set imports) throws SAXException, IOException
uri
.
uri
- The name of the ontology to be imported.imports
- A Set
that contains a list of strings
that represent the names of the ontologies that have already been
imported.
SAXException
IOException
public void run(InputStream is, String uri) throws Exception
Exception
public void run(Reader reader, String uri) throws Exception
Exception
public void run(URI uri) throws Exception
Exception
public void setLogger(ProtegeOWLParserLogger logger)
private void setPrefixForDefaultNamespace(String prefixForDefaultNamespace)
public void setURI2NameConverter(URI2NameConverter converter)
public void setURLResolver(URIResolver urlResolver)
public static InputStream getInputStream(URL url) throws IOException
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |