the-virtual-brain / tvb-ext-ontology

GNU General Public License v3.0
1 stars 0 forks source link

Consider dependencies when adding classes to the workspace. #4

Open leon-k-martin opened 1 month ago

leon-k-martin commented 1 month ago

Background

Some Methods have specific requirements/dependencies. For example, the JansenRit model requires its own coupling SigmoidalJansenRit

Goal

Implementation

I added the required nodes already to the class dictionary:

def ontoclass2dict(ontoclass):
    """
    Convert an OntoClass object to a JSON object
    Args:
        ontoclass: OntoClass object
    Returns:
        dict: JSON object
    """
    return {
        "id": uid2int(ontoclass.identifier),
        "iri": ontoclass.iri,
        "label": ontoclass.label.first(),
        "symbol": label2symbol(ontoclass),
        "type": ontology.get_type(ontoclass).label.first(),
        "definition": ontoclass.definition.first(),
        "collapsed": True,
        "childNodes": [],
        "childLinks": [],
        "is_a": [p.name for p in ontoclass.is_a if isinstance(p, owl.ThingClass)],
        "requires": [
            p.name for p in ontoclass.requires
        ],
    }

Would it be possible to implement a mechanism in the front-end that co-adds the corresponding classes to the workspace?

romina1601 commented 1 month ago

Yes, we can totally do this. What would be the strategy in case there is more than just one option available?

leon-k-martin commented 1 month ago

Maybe we can highlight the edges representing dependencies so the user can choose between options if more are available. Something like in https://github.com/vasturiano/react-force-graph/blob/master/example/highlight/index.html

image

What do you say?