From: Ignazio P. <ipa...@gm...> - 2012-10-27 14:04:50
|
On 27 October 2012 01:52, Rouquette, Nicolas F (313K) <nic...@jp...> wrote: > Ignazio, > > In our infrastructure, we need an explicit ontology of OWL2 including > datatype maps. > We started from this: http://www.w3.org/2007/OWL/wiki/Owl2.owl6 > And we added the imported ontologies (or approximations of them based on > what we could find). > > We settled on the following kernel of 6 ontologies whose import relations > induces a strongly connected directed graph: > > http://purl.org/dc/elements/1.1 > http://www.w3.org/2000/01/rdf-schema > http://www.w3.org/2002/07/owl > http://www.w3.org/1999/02/22-rdf-syntax-ns > http://www.w3.org/2003/g/data-view > http://www.w3.org/2001/XMLSchema > > (if there are official / bug-free versions of these, we'd love to use > them!) > > To avoid confusion with whatever is available (or not), we use an OASIS > XML Catalog technique like Protégé to remap the above IRIs to local files > (attached). > > Thank you, I'll look at what went wrong. > > According to the comments on OWLOntology.getDirectImports(), there can be > fewer ontologies in the result than imported documents if some ontologies > aren't loaded for some reason. > We consider this possibility a silent failure so we use > ont.getDirectImportDocuments() instead and verify that each imported > document IRI resolves to an ontology whose version IRI (if any) or > ontology IRI matches that document IRI. Another reason might be that two different imports resolve to the same ontology - in that case, the results are equivalent. However there are three variables at play here: ontology IRI, document IRI and version IRI (when there is one) need not be the same. I suspect what's missing is a check through the loaded documents. I. > > - Nicolas. > > On 10/26/12 2:51 PM, "Ignazio Palmisano" <ipa...@gm...> > wrote: > >>On 26 October 2012 22:05, Rouquette, Nicolas F (313K) >><nic...@jp...> wrote: >>> With 3.4.1 (revision 2092), our code fails when we try to get an >>>imported >>> ontology like this: >>> >>> OWLOntologyManager ontManager = Š; >>> >>> OWLOntology ont = Š; >>> >>> for (IRI directImportDocumentIRI : ont.getDirectImportsDocuments()) { >>> OWLOntology directImportOntology = >>> ontManager.getOntology(directImportDocumentIRI); // << throws >>> OWLOntologyDocumentAlreadyExistsException >>> Š >>> >>> The exception comes from OWLOntologyManagerImpl, line 295 below: >>> >>> >> >>Thanks for reporting this, it looks to me like a problem with the >>relations between document names and ontology iris. >>Can you print out the directImportDocumentIRIs and the ontology ids >>for the ontologies in the import closure - or share the ontology on >>which this happens? >>I'm trying to figure out if there is a mismatch between document iris >>and ontology iris, and how to work it out. >>In the meantime, ontology.getDirectImports() should return the set of >>imported ontologies without the need for you to manually retrieve >>them. >>HTH, >>I. >> >>> public OWLOntology getOntology(IRI ontologyIRI) { >>> OWLOntologyID ontologyID = new OWLOntologyID(ontologyIRI); >>> // return getOntology(ontologyID); >>> OWLOntology result = ontologiesByID.get(ontologyID); >>> if (result == null) { >>> for (OWLOntologyID nextOntologyID : >>>ontologiesByID.keySet()) { >>> if (ontologyIRI.equals(nextOntologyID.getVersionIRI())) >>>{ >>> result = ontologiesByID.get(nextOntologyID); >>> } >>> } >>> } >>> // HACK: This extra clause is necessary to make getOntology >>>match >>> the >>> // behaviour of createOntology >>> // in cases where a documentIRI has been recorded, based on the >>> mappers, >>> // but an ontology has not >>> // been stored in ontologiesByID >>> if (result == null) { >>> IRI documentIRI = getDocumentIRIFromMappers(ontologyID, >>>true); >>> if (documentIRI == null) { >>> if (!ontologyID.isAnonymous()) { >>> documentIRI = ontologyID.getDefaultDocumentIRI(); >>> } else { >>> documentIRI = IRI.generateDocumentIRI(); >>> } >>> Collection<IRI> existingDocumentIRIs = >>> documentIRIsByID.values(); >>> while (existingDocumentIRIs.contains(documentIRI)) { >>> documentIRI = IRI.generateDocumentIRI(); >>> } >>> } >>> if (documentIRIsByID.values().contains(documentIRI)) { >>> throw new RuntimeException(new >>> OWLOntologyDocumentAlreadyExistsException( // line 295 >>> documentIRI)); >>> } >>> } >>> return result; >>> } >>> >>> >>> >>> What is the rationale for getOntology(IRI) to throw >>> OWLOntologyDocumentAlreadyExistsException when we precisely want to >>> retrieve the ontology document? >>> >>> - Nicolas. >>> >>> >>> >>>------------------------------------------------------------------------- >>>----- >>> WINDOWS 8 is here. >>> Millions of people. Your app in 30 days. >>> Visit The Windows 8 Center at Sourceforge for all your go to resources. >>> http://windows8center.sourceforge.net/ >>> join-generation-app-and-make-money-coding-fast/ >>> _______________________________________________ >>> Owlapi-developer mailing list >>> Owl...@li... >>> https://lists.sourceforge.net/lists/listinfo/owlapi-developer >> >>-------------------------------------------------------------------------- >>---- >>WINDOWS 8 is here. >>Millions of people. Your app in 30 days. >>Visit The Windows 8 Center at Sourceforge for all your go to resources. >>http://windows8center.sourceforge.net/ >>join-generation-app-and-make-money-coding-fast/ >>_______________________________________________ >>Owlapi-developer mailing list >>Owl...@li... >>https://lists.sourceforge.net/lists/listinfo/owlapi-developer > > > ------------------------------------------------------------------------------ > WINDOWS 8 is here. > Millions of people. Your app in 30 days. > Visit The Windows 8 Center at Sourceforge for all your go to resources. > http://windows8center.sourceforge.net/ > join-generation-app-and-make-money-coding-fast/ > _______________________________________________ > Owlapi-developer mailing list > Owl...@li... > https://lists.sourceforge.net/lists/listinfo/owlapi-developer > |