-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
15 define and store a generic example with nested structure #17
base: main
Are you sure you want to change the base?
15 define and store a generic example with nested structure #17
Conversation
@cmclscourtney, @francescalb, @sygout
My suggestion would be that this library provides three functions: def from_cuds_metadata(ts: Triplestore, iri: str, uri: str, conf: Mapping = None) -> dlite.Metadata:
"""Creates a DLite data model from CUDS stored in triplestore.
By default are all data property restrictions directly translated into DLite properties of corresponding type and object properties translated into reference properties.
Arguments:
ts: Reference to triplestore.
iri: IRI of CUDS class to represent as a DLite data model.
uri: URI of the new DLite metadata.
conf: A mapping for customisation of the created data model.
Returns:
New DLite Metadata.
"""
def from_cuds(ts: Triplestore, iri: str, metaid: str, coll: dlite.Collection = None, label: str = None) -> dlite.Instance:
"""Creates a DLite instance from CUDS individuals stored in triplestore.
Arguments:
ts: Reference to triplestore.
iri: IRI of CUDS individual to represent as a DLite data model.
metaid: URI or UUID or DLite data model to instantiate.
coll: If provided, the new instance together with some relations will be added to this collection.
label: Label assigned to the new instance in the collection.
Returns:
Reference to new instance.
"""
def to_cuds(ts: Triplestore, inst: dlite.Instance, coll: dlite.Collection = None, conf: Mapping = None) -> None:
"""Store CUDS individuals representing a DLite instance to a triplestore.
Arguments:
ts: Reference to triplestore.
inst: IRI of CUDS individual to represent as a DLite data model.
coll: Collection to fetch additional relations from needed to create the CUDS.
conf: Optional additional instructions for creating the CUDS. (Needed??)
""" The interesting question is in the details in how to do the conversion. @cmclscourtney, does the CUDS ontology and A-box example you added to the examples/ folder contain all the complexity you need? |
DLite exceptions are now created dynamically, which clearly confuses pylint.
Sorry! I made this ready-for -review by mistake. And I do not see where to revert that :( |
@jesper-friis, I'm not sure I fully understand your question either but I think the answer is yes. You can see the MoDS ontolgy here. I did intend for that example to be sufficiently general. I believe the structure you are referring to with the restictions on the properties is inherent to SimPhoNy. |
@cmclscourtney , With the updated implementation we can now convert between the files you have provided. Please let us know if this is sufficient for your needs. |
@francescalb @jesper-friis @sygout
Adding example generic cuds object with a nested structure. I would love to get your insight into how this could be improved but could be good to have this to aim towards in testing the conversion.