Hi Steve,
it seems you have discovered a bug. I've made a few runs myself. This is
happening because of the materialized inverses in the registry.
Having both
<Library1 hasOntology fedora-relsext-ontology.rdfs>
and
<fedora-relsext-ontology.rdfs isOntologyOf Library1>
is causing a loop. My bad.
Having one of them only should work, but please do not change the
registry now. This is a mistake on the Stanbol side and I have to
correct it asap.
You can watch https://issues.apache.org/jira/browse/STANBOL-495 for the
record.
Best regards,
Alessandro
On 2/15/12 4:56 PM, Stephen Bayliss wrote:
Thanks Alessandro.
That's most helpful - I'll come back on "why can't I just do that with a
simple line of code..." once I can see it all working.
Currently I'm attempting to follow those examples to create a registry with
a single library containing two ontologies:
1) http://www.fedora.info/definitions/1/0/fedora-relsext-ontology.rdfs
2) http://www.w3.org/2009/08/skos-reference/skos.rdf
(note the first is just rdfs, the second is owl; also the URI used for the
second is the URI that resolves to the document; the URI identifying the
ontology is different - not sure if any of these are issues).
So I've constructed:
http://www.acuityunlimited.net/ontologies/iks/fedoracore.rdf
Using the Felix config console I add this, but I see a couple of errors in
the logs (plus, after loading I can no longer activate my bundle, grabbing
the @Reference, it complains of an unsatisifed dependency for the
RegistryManager).
The errors are:
---
15.02.2012 18:35:18.619 *WARN* [CM Event Dispatcher (Fire
ConfigurationEvent: pi
d=org.apache.stanbol.ontologymanager.registry.impl.RegistryManagerImpl)]
org.apa
che.stanbol.ontologymanager.registry.impl.RegistryManagerImpl Invalid
registry c
onfiguration - Skipping... java.lang.IllegalArgumentException: URI is not
absol
ute
at java.net.URI.toURL(URI.java:1080)
at
uk.ac.manchester.cs.owl.owlapi.ParsableOWLOntologyFactory.canLoad(Par
sableOWLOntologyFactory.java:160)
at
uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OW
LOntologyManagerImpl.java:722)
at
uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OW
LOntologyManagerImpl.java:667)
at
uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OW
LOntologyManagerImpl.java:641)
at
org.apache.stanbol.ontologymanager.registry.impl.RegistryManagerImpl.
activate(RegistryManagerImpl.java:207)
at
org.apache.stanbol.ontologymanager.registry.impl.RegistryManagerImpl.
activate(RegistryManagerImpl.java:170)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
---
and
---
15.02.2012 18:35:21.166 *ERROR* [CM Event Dispatcher (Fire
ConfigurationEvent: p
id=org.apache.stanbol.ontologymanager.registry.impl.RegistryManagerImpl)]
org.ap
ache.stanbol.ontologymanager.registry
[org.apache.stanbol.ontologymanager.regist
ry.impl.RegistryManagerImpl] The activate method has thrown an exception
(java.l
ang.StackOverflowError) java.lang.StackOverflowError
at
uk.ac.manchester.cs.owl.owlapi.OWLNamedIndividualImpl.accept(OWLNamed
IndividualImpl.java:195)
at
org.semanticweb.owlapi.util.OWLObjectTypeIndexProvider.getTypeIndex(O
WLObjectTypeIndexProvider.java:173)
at
uk.ac.manchester.cs.owl.owlapi.OWLObjectImpl.compareTo(OWLObjectImpl.
java:183)
at
uk.ac.manchester.cs.owl.owlapi.OWLObjectImpl.compareTo(OWLObjectImpl.
java:74)
at java.util.TreeMap.put(TreeMap.java:545)
at java.util.TreeSet.add(TreeSet.java:238)
at
uk.ac.manchester.cs.owl.owlapi.OWLIndividualImpl.getObjectPropertyVal
ues(OWLIndividualImpl.java:200)
at
uk.ac.manchester.cs.owl.owlapi.OWLIndividualImpl.getObjectPropertyVal
ues(OWLIndividualImpl.java:132)
at
org.apache.stanbol.ontologymanager.registry.impl.RegistryManagerImpl.
populateLibrary(RegistryManagerImpl.java:559)
at
org.apache.stanbol.ontologymanager.registry.impl.RegistryManagerImpl.
populateOntology(RegistryManagerImpl.java:589)
at
org.apache.stanbol.ontologymanager.registry.impl.RegistryManagerImpl.
populateLibrary(RegistryManagerImpl.java:561)
---
I suspect I've got something fairly basic wrong in my document for the
Registry, but I can't work out what it might be.
Can you spot anything that looks wrong?
Thanks
Steve
-----Original Message-----
From: Alessandro Adamou [mailto:[email protected]]
Sent: 14 February 2012 13:19
To: [email protected]
Subject: Re: OntologyManager Registry Java API examples
Hi Steve,
Thank you for your interest. It seems I should probably add
more input
to the docs.
I can see how one can create a RegistryOntology from an
OWLNamedIndividual, and one can create a Library similarly, and
presumably then use Library#addChild to add one or more
ontologies to
the library.
You are most likely not going to need the Java API in order
to configure
your libraries. You can use the Felix console for most of it.
A Registry is itself an ontology. It can reference one or more
libraries, each identified by an IRI, and more registries can
reference
different libraries or add ontologies to the same library.
An example is the unit test resource at
http://svn.apache.org/repos/asf/incubator/stanbol/trunk/ontolo
gymanager/registry/src/test/resources/ontologies/registry/onmtest.owl
or the first stub of "IKS default ontologies" registry at
http://svn.apache.org/repos/asf/incubator/stanbol/trunk/ontolo
gymanager/registry/src/main/resources/ontologies/registry/iksn
etwork.owl
But I'm struggling with the usage of Registry; how do I create this
and add my Library? Presumably I need to do this and then use the
RegistryManager#addRegistry(Registry) to register my ontologies
After creating such an RDF document, you have to put it
online so as to
have a physical IRI. In my TODO list, you will also be able
to provide
the file in a bundle so that the Data file provider will load it.
Then go to the Stanbol Felix configuration console, open the Ontology
Registry Manager configuration and add the physical location of the
Registry.
The internal model for the registry (addChild() and
everything) will be
created by itself. If you keep the default configuration (i.e. lazy
loading), the ontologies referenced by the registry will
*not* be loaded
until you "touch" a library.
Overall the use case is to use a LibrarySource to load several
ontologies into a space's core scope.
This is when you "touch" the library indeed, and where you
could use the
Java API.
the registry manager is an OSGi service component (you have
to supply it
because library sources are not components):
@Reference
RegistryManager registryManager;
new LibrarySource(libraryIRI, registryManager)
Now all the referenced ontologies are loaded (using the Clerezza
ontology provider from OntoNet) and appended to a new root
ontology. You
can then feed this source to a space or session.
The ontologies loaded from a library will be loaded using the same
storage backend as OntoNet (by default, the Clerezza one),
whereas the
model of libraries is in-memory OWL API stuff (but should always be
reasonably small).
Is there anything here that triggered a thought in your head
like "but
why can't I just do that with a simple line of code such as
_____" ? We
can work with that I suppose.
Perhaps I can help you shape your registry. How is the knowledge base
you'd like to structure into libraries organised?
All the best,
Alessandro
--
M.Sc. Alessandro Adamou
Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, 40127 Bologna - Italy
Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy
"As for the charges against me, I am unconcerned. I am beyond
their timid, lying morality, and so I am beyond caring."
(Col. Walter E. Kurtz)
Not sent from my iSnobTechDevice
--
M.Sc. Alessandro Adamou
Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, 40127 Bologna - Italy
Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy
"As for the charges against me, I am unconcerned. I am beyond their timid, lying
morality, and so I am beyond caring."
(Col. Walter E. Kurtz)
Not sent from my iSnobTechDevice