atextor / owl-cli

Command line tool for ontology engineering
Apache License 2.0
14 stars 2 forks source link

`diagram` takes lots of memory for a large ontology #17

Open VladimirAlexiev opened 2 months ago

VladimirAlexiev commented 2 months ago

Get https://www.entsoe.eu/Documents/CIM_documents/Grid_Model_CIM/IEC61970-600-2_CGMES_3_0_1_ApplicationProfiles.zip Take this ontology v3.0/RDFSEd2Beta/IEC61970-600-2_CGMES_3_0_0_RDFS_501Ed2CD_EQ.rdf It's 528k rdf, 384k ttl (converted with jena riot).

java -jar c:/prog/bin/owl-cli-snapshot.jar diagram IEC61970-600-2_CGMES_3_0_0_RDFS_501Ed2CD_EQ.ttl

On Windows 11, this takes 1.2G "private bytes" of memory and 370M "working set" (and growing). It's been running for a few minutes now , but the svg remains empty.

I question the wisdom of trying to make a diagram from a large ontology (this one is actually mid-size), so maybe it's a user's problem...

VladimirAlexiev commented 2 months ago

@atextor Sorry, wrong project! Can you move this to https://github.com/atextor/owl-cli, or I should recreate it there?

atextor commented 2 months ago

Hi @VladimirAlexiev, I have moved the issue to owl-cli. Thanks for reporting. We should probably investigate the memory usage, and especially when no output is produced. Still I expect that for an ontology of this size you can't create a useful diagram. Even when the SVG generation works, you'd still need to have a viewer deal with it. The diagram feature was originally intended for smaller parts of an ontology (e.g., to show the relationships between 5-10 classes/properties/restrictions). owl-cli should provide a convenient way to select subsets of a larger ontology; you can of course already do this using some preprocessing, but it's tedious.

Some improvements are probably necessary to have the feature "just work" for any ontology, be it schema-heavy, instance-heavy and of various sizes.

VladimirAlexiev commented 2 months ago

Do you have some examples? I'd love to see some diagrams of the Bosch Stack

atextor commented 2 months ago

Since you're asking, let me give you some background on the diagram functionality. I invented the diagram notation out of necessity as a by-product when writing my PhD thesis to be able to express ontologies - including all types of axioms - in a readable but precise way (as opposed to some UML-esque approximation). It is supposed to be a lot easier to read than long listings of description logic notation. Due to a lack of time, I manually created the required diagrams then, but always planned to be able to generate them automatically. In owl-cli I implemented this automatic generation (way after the thesis was finished :-)) but still with the focus on diagrams that comfortably fit on a screen or an A4 page. I think for bigger graphs, approaches that are more interactive than static diagrams might be better suited; with panning/zooming/filtering/dynamic layouts etc.

That being said, Bosch Semantic Stack is not affiliated with owl-cli, I just happen to work on both. But similar problems were and are still addressed in the context of Bosch Semantic Stack as well: large parts of its modeling infrastructure are developed as Open Source in the Eclipse Semantic Modeling Framework, which also includes a command line tool that generates automatically-layouted diagrams from RDF-based model files (but using the SAMM format instead of OWL). Examples for these files you can find in the models repository of the Eclipse Tractus-X project, including an HTML diagram for each model file that also includes a generated diagram (in the gen folder of each model, for example here). tl;dr: The above link contains examples for models and diagrams that are related to Bosch Semantic Stack since both Tractus-X and Bosch Semantic Stack use the same model formalism (SAMM), but it's not OWL and it's not generated using owl-cli.