OpenEnergyPlatform / oeplatform

Repository for the code of the Open Energy Platform (OEP) website. The OEP provides an interface to the Open Energy Family
http://openenergyplatform.org/
GNU Affero General Public License v3.0
61 stars 19 forks source link

Create an overview (e.g. table) or guide to enable developers / users to find any concept used in the oekg (scenario bundles) #1678

Open jh-RLI opened 2 weeks ago

jh-RLI commented 2 weeks ago

Description of the issue

During development, I realised that for someone who is not yet familiar with the OEO/OEKG (scenario bundle), it is not clear how to find the correct IDs of certain subjects/objects/predicates.

For example, I have created a query that:

  1. retrieves all scenarios where a table is listed as an input/output record
  2. retrieves all bundles in which the scenario is listed

I had to find out that there is an OEO_00020227 = Scenario Bundle and OEO_00000365 = Scenario factsheet type and a relation like RO_0002233 = has_input relation is used in the oekg. From https://openenergyplatform.github.io/organisation/family_members/knowledge-representation/oekg/#structure I can understand that there are relations, but if I want to implement something, I need more details like "Scenario Bundle" is actually OEO_00010252. Then when I go to https://openenergyplatform.org/ontology/oeo/OEO_00010252/ I realise that the bundle there is called scenario study, which makes perfect sense to me but might confuse others.

I also started with this https://openenergyplatform.org/ontology/oeo/OEO_00000365/ and now realised that it is no longer used in the OEKG. I think it might be confusing whether a scenario bundle is a scenario factsheet or a scenario study.

Here i provide a example of my code to show why the ids are relevant. See the self.oekg.triples() queries (None means all available):

def get_related_scenarios_where_table_is_input_dataset(self, table_iri):
        """
        Query the OEKG to get all scenarios that list the current table as
        input dataset.

        Args:
            table_iri(str): IRI of any table in the scenario topic on the OEP.
                            IRI Like 'dataedit/view/scenario/abbb_emob'

        """
        related_scenarios = set()

        # Find all scenario bundles
        for s, p, o in self.oekg.triples((None, RDF.type, namespaces.OEO.OEO_00010252)):
            # find all scenarios in any bundle
            for s1, p1, o1 in oekg.triples((s, namespaces.OEKG["has_scenario"], None)):
                # # Find scenarios where the given table is the input dataset
                for s2, p2, o1_input_ds_uid in self.oekg.triples(
                    (o1, namespaces.OEO.RO_0002233, None)
                ):
                    if o1_input_ds_uid is not None:
                        for s3, p3, o3_input_ds_iri in oekg.triples(
                            (
                                o1_input_ds_uid,
                                namespaces.OEO["has_iri"],
                                Literal(table_iri),
                            )
                        ):
                            related_scenarios.add(s2)

        return related_scenarios

Ideas of solution

It would be great to have an overview that list all objects like "Scenario Bundle" and then list all available relations for this object. Both the readable (like Scenario study) and technical information (like the ID: OEO_00010252) is relevant.

Maybe we can create a list where all relevant ID´s are listed with thier name. Or we can enhance the oeo integration in the OEP to provide a better overview? Im not fully sure what the best solution is.

Workflow checklist