BrickSchema / Brick

Uniform metadata schema for buildings
http://brickschema.org/
BSD 3-Clause "New" or "Revised" License
289 stars 78 forks source link

Unable to load Brick.ttl 1.4.1 in Protege #657

Closed ar-chad closed 2 weeks ago

ar-chad commented 3 weeks ago

There is an issue with loading Brick.ttl 1.4.1 in Protege

At some point it can't resolve import: Screenshot 2024-09-10 at 15 56 52

And after that fails with an error: Screenshot 2024-09-10 at 15 58 06

Stack trace of the error is bellow:

Ontology already exists. OntologyID(OntologyIRI(http://qudt.org/2.1/vocab/dimensionvector) VersionIRI())

Full Stack Trace

org.semanticweb.owlapi.model.OWLOntologyAlreadyExistsException: Ontology already exists. OntologyID(OntologyIRI(http://qudt.org/2.1/vocab/dimensionvector) VersionIRI()) at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1253) at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:1200) at org.protege.editor.owl.model.io.OntologyLoader.loadOntologyInternal(OntologyLoader.java:124) at org.protege.editor.owl.model.io.OntologyLoader.lambda$loadOntologyInOtherThread$0(OntologyLoader.java:71) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: org.semanticweb.owlapi.model.OWLOntologyRenameException: Could not rename ontology. An ontology with this ID already exists: OntologyID(OntologyIRI(http://qudt.org/2.1/vocab/dimensionvector) VersionIRI()) change: SetOntologyIDData(OntologyID(OntologyIRI(http://qudt.org/2.1/vocab/dimensionvector) VersionIRI())) at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.checkForOntologyIDChange(OWLOntologyManagerImpl.java:882) at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.enactChangeApplication(OWLOntologyManagerImpl.java:642) at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.applyChanges(OWLOntologyManagerImpl.java:670) at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.applyChange(OWLOntologyManagerImpl.java:820) at org.semanticweb.owlapi.rdf.rdfxml.parser.OWLRDFConsumer.applyChange(OWLRDFConsumer.java:733) at org.semanticweb.owlapi.rdf.rdfxml.parser.OWLRDFConsumer.chooseAndSetOntologyIRI(OWLRDFConsumer.java:1492) at org.semanticweb.owlapi.rdf.rdfxml.parser.OWLRDFConsumer.endModel(OWLRDFConsumer.java:1393) at org.semanticweb.owlapi.rio.RioOWLRDFConsumerAdapter.endRDF(RioOWLRDFConsumerAdapter.java:78) at org.semanticweb.owlapi.rio.RioParserImpl$RioParserRDFHandler.endRDF(RioParserImpl.java:300) at org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:170) at org.eclipse.rdf4j.rio.turtle.TurtleParser.parse(TurtleParser.java:125) at org.semanticweb.owlapi.rio.RioParserImpl.parseDocumentSource(RioParserImpl.java:245) at org.semanticweb.owlapi.rio.RioParserImpl.parse(RioParserImpl.java:185) at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:220) at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.actualParse(OWLOntologyManagerImpl.java:1303) at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1243) ... 7 more

gtfierro commented 2 weeks ago

Hi @ar-chad ! I wonder if this is fixed since we updated the version of QUDT imported by Brick. I was able to load the latest nightly build in Protege successfully this morning. Can you give it a try when you get a chance?

ar-chad commented 2 weeks ago

@gtfierro thank you for fixing this. I was able to load Brick+imports.ttl, Brick-only.ttl Brick+extensions.ttl and Brick.ttl from the latest nightly build with the latest available version of Protege (5.6.4), in this order.

steveraysteveray commented 2 weeks ago

@gtfierro, I was going to try to help by looking at the QUDT imports, but I cannot generate the Brick ttl files any more. I used to be able to go to the Brick repo and run my alias that is defined as follows:

rm -r brickvenv;python3 -m venv brickvenv;source brickvenv/bin/activate;pip install -r requirements.txt;pre-commit install;python generate_brick.py'

but now it says:

Traceback (most recent call last):
  File "/Users/steveray/Repositories/Brick/generate_brick.py", line 22, in <module>
    from bricksrc.env import env
  File "/Users/steveray/Repositories/Brick/bricksrc/env.py", line 3, in <module>
    env = OntoEnv(cfg)
          ^^^^^^^^^^^^
ValueError: IO error for operation on rec/Source/SHACL/RealEstateCore: No such file or directory (os error 2)

Any suggestions on what I'm missing?

gtfierro commented 2 weeks ago

The RealEstateCore stuff is now in a git submodule! If you run the command from step 2 then the build should work

steveraysteveray commented 2 weeks ago

Thanks, that did the trick! I'll update my alias definition.

(Incidentally, do you include imports/qudtusertest.ttl in your build? I'm not sure I'm looking in the right place)

gtfierro commented 2 weeks ago

I think it is currently included. https://github.com/BrickSchema/Brick/blob/master/bricksrc/ontology.py#L36 has the list of imports for the Brick build