Skip to content

Support for documenting not (yet) existing resources #369

@jesper-friis

Description

@jesper-friis

Resources that does not exists (yet), should be documented in the Tbox.

Suggested implementation strategy:

Create a new module tripper.datadoc.tboxdoc.

Add a general function that takes a dict-like description of a non-existing resource. For example a physics-based simulation that has not yet been executed:

{
    "@context": ["https://w3id.org/emmo/context", "https://w3id.org/emmo/domain/mydomain/context"],
    "@id": "ex:MyModelSimulation",
    "@type": "owl:Class",
    "subClassOf": "PhysicsBasedSimulation",
    "prefLabel": "MyModelSimulation",
    "elucidation": "A simulation using my physics-based materials models.",
    "isParticipatedBy": {
        "@id": "ex:MyModel",
        "@type": "owl:Class"  # restrictionType defaults to some
    },
    "command": "mymodel infile.txt -o outfile.txt",  # Command to execute the model
    "workdir": ".",  # Relative path to working directory
    "environment": {"VAR1": "val1", "VAR2": "val2"},  # Environment variables (JSON-encoded)
    "install_command": "pip install git+ssh://git@github.com:MyProj/myrepo.git@master",
    "hasInput": [
        {
            "@id": "ex:MyInputDataset",
            "@type": "owl:Class",
            "subClassOf": ["dcat:Dataset", "emmo:Dataset"],
            "restrictionType": "exactly 1",  # defaults to "some"
            "prefLabel": "MyInputDataset.",
            "elucidation": "My input dataset.",
            "distribution": {
                "accessURL": "file:./infile.txt",
                "accessService": {
                    "conformsTo": "https://github.com/SINTEF/dlite/",
                    "generator": "ex:inputplugin"  # for generating input
                }
            }
        }
    ],
    "hasOutput": [
        {
            "@id": "ex:MyOutputDataset",
            "@type": "owl:Class",
            "subClassOf": ["dcat:Dataset", "emmo:Dataset"],
            "restrictionType": "exactly 1",  # defaults to "some"
            "prefLabel": "MyOutputDataset.",
            "elucidation": "My output dataset.",
            "distribution": {
                "accessURL": "file:./outfile.txt",
                "accessService": {
                    "conformsTo": "https://github.com/SINTEF/dlite/",
                    "parser": "ex:outputplugin",  # for parsing output
                    "generator": "ex:outputplugin"  # for storing output to external storage
                }
            }
        }
    ]
}

When a type is "Class" (owl:Class), a class is generated in the KB instead of an individual. From the above input, our new function should generate the following RDF:

ex:MyModelSimulation rdf:type owl:Class ;
    rdfs:subClassOf emmo:PhysicsBasedSimulation ,
    [
        rdf:type owl:Restriction ;
        owl:onProperty emmo:hasInput ;
        owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
        owl:onClass ex:MyInputDataset ;
    ] ,
    [
        rdf:type owl:Restriction ;
        owl:onProperty emmo:hasOutput ;
        owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
        owl:onClass ex:MyOutputDataset ;
    ] ,
    [
        rdf:type owl:Restriction ;
        owl:onProperty emmo:isParticipatedBy ;
        owl:someValuesFrom ex:MyModel ;
    ] ;
    skos:prefLabel "PremodSimulation"@en ;
    emmo:elucidation "A simulation using my physics-based materials models."@en ;
    oteio:command "mymodel infile.txt -o outfile.txt" ;
    oteio:workdir "." ;
    oteio:environment "{\"VAR1\": \"val1\", \"VAR2\": \"val2\"}"^^rdf:JSON ;
    oteio:installCommand "pip install git+ssh://git@github.com:MyProj/myrepo.git@master" .

ex:MyInputDataset rdf:type owl:Class ;
    rdfs:subClassOf dcat:Dataset, emmo:Dataset ;
    skos:prefLabel "MyInputDataset"@en ;
    emmo:elucidation "My input dataset."@en ;
    dcat:distribution [
        rdf:type dcat:Distribution ;
        dcat:accessURL <file:./infile.txt> ;
        dcat:accessService [
            rdf:type dcat:DataService ;
            dcterms:conformsTo <https://github.com/SINTEF/dlite/> ;
            oteio:generator: ex:inputplugin ;  
        ] ;
    ] .

ex:MyOutputDataset rdf:type owl:Class ;
    rdfs:subClassOf dcat:Dataset emmo:Dataset ;
    skos:prefLabel "MyOutputDataset"@en ;
    emmo:elucidation "My output dataset."@en ;
    dcat:distribution [
        rdf:type dcat:Distribution ;
        dcat:accessURL <file:./infile.txt> ;
        dcat:accessService [
            rdf:type dcat:DataService ;
            dcterms:conformsTo <https://github.com/SINTEF/dlite/> ;
            oteio:parser: ex:myoutputplugin ;
            oteio:generator: ex:myoutputplugin ;
        ] ;
    ] .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions