DerwenAI / kglab

Graph Data Science: an abstraction layer in Python for building knowledge graphs, integrated with popular graph libraries – atop Pandas, NetworkX, RAPIDS, RDFlib, pySHACL, PyVis, morph-kgc, pslpython, pyarrow, etc.
https://derwen.ai/docs/kgl/
MIT License
571 stars 65 forks source link

UML support #190

Open ceteri opened 3 years ago

ceteri commented 3 years ago

Provide support for working with UML diagrams as graphs, e.g., applying inference, shape constraints, probabilistic rules, etc.

These are the approximate steps to follow:

  1. Identify a reasonably small UML diagram to use as test case.
  2. Scope/Discovery: in what ways are UML diagrams represented commonly?
  3. Reuse a Python library or write new code to parse UML
  4. As this stage, @ceteri can assist on RDF semantic representation
  5. Add an import_uml method to KnowledgeGraph
charlesvardeman commented 3 years ago

There is a python tool called shacl2plantuml that can generate Plant UML from SHACL files that could be relatively straight forward to add to kglab. I think standard UML "boxology" is ok for SHACL but not expressive enough for an OWL or RDFS based ontology. Chowlk visual notation may be more useful for diagramming OWL based ontologies because of the added expressivity. There is a template for diagrams.net and a web service that can generate a turtle rdf serialization from the diagrams.net xml file. The workflow I am playing with/considering is excalidraw for collaborative concept mapping (I kind of like the "hand drawn" aesthetic) -> redraw concept map using chowlk notation in diagrams.net and generate initial OWL output in Turtle -> Protege for sanity check and additional formalism/annotations for FAIR ontologies -> committed to GitHub, generation of W3ID namespace that resolves to GitHub, Generation of Documentation using [PyLODE(https://github.com/RDFLib/pyLODE) or Widoco -> Generation of Shapes (SHACL or ShEx) generating a "closed world" based on application user stories/use case.

ceteri commented 3 years ago

Thank you so much @charlesvardeman !

Integrating shacl2plantuml into the SHACL features should be quick. If you'd like to drop in a PR, we'd be delighted – or I can put that in soon too.

BTW, have you seen anything attempting the opposite direction? In other words, parsing some popular means of representing UML diagrams, so that we could translate into the graph abstractions here?

charlesvardeman commented 2 years ago

Interesting new paper "Visual Notations for Viewing RDF Constraints with UnSHACLed" that combines VOWL and UML visualizations. There is a node based editor KNowledgeOnWebScaleunshacled. To be useful it would probably need to be integrated in with JupyterLab similar to the jupyterlab-drawio.