Giter Site home page Giter Site logo

mi-fraunhoferiwm / dsms-python-sdk Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 1.53 MB

Python SDK core-package for working with the DataSpace Management System (DSMS)

Home Page: https://dsms-python-sdk.readthedocs.io/en/latest/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
data datamodel dataschema dataspace interoperability knowledge-graph material-science materials-informatics ontology python

dsms-python-sdk's Issues

Move QR Code generation into remote backend

Currently, the QR code generation for the avatar is part of the SDK.

However, it makes sense to move this functionality to the knowledge service so that it can also be executed via the frontend.

Add function to get hdf5 column by name

In the current version of the SDK, a user can access the individual hdf5-columns via indexing:

column0 = item.hdf5[0].get()
column1 = item.hdf5[1].get()

The column-objects also have names and column-ids.

assert 0 == item.hdf5[0].column_id
assert "Zeit" == item.hdf5[0].name

Additionally, he/she can also can download the whole dataframe:

df = item.hdf5.to_df()

However, the user should also be able to access the dataframe through the name or the id, like e.g.:

column0 = item.hdf5.get(name="Zeit")
column1 = item.hdf5.get(id=1)

This minor function needs to be implemented.

Improve committing and detection in changes of the KItem payload.

Currently, changes are commited in the _updated_kitem even if the payload has not been changed.

This is due to the fact that the KItem is flagged as updated even if other properties such as the attachment or the avatar have been updated.

However, changes in e.g. the custom_properties are not properly updated.

Thus, this has to be properly implemented in the related private function for commiting.

Upgrade pandas to >=2,<3

In order to be compatiable with the latest pandas version, this repo needs to be upgraded to pandas>=2,<3. Same also holds for data2rdf.

Improve printing of linked kitems

Currently, only the IDs of the linked kitems are printed.

Perhaps that can be improved that also the name and the ktype or even the custom properties of the linked kitems can be printed.

In an ideal way, this can be set in the Configuration in order to avoid possible performance issues.

Add "is_a" function for the kitem for idenfitying ktype

For semantic identification of a KItem, it makes sense to add an method with is_a to the KItem object itself in order to make a boolean operation against an existing Ktype.

E.g. :

from dsms import DSMS, KItem

dsms = DSMS(env=".env")

item = KItem(name="my_kitem", ktype_id=dsms.ktypes.Dataset)

assert item.is_a(dsms.ktypes.Dataset)

Move "get" function of LinkedKItems to LinkedKItem itself

In order to make the retrieval of linked KItems easier, it makes sense to move the get function of the list of LinkedKItems to the property of the LinkedKItem itself. The following code will look like this:

from dsms import DSMS, KItem

dsms = DSMS(env=".env)

item1 = KItem(name="item1", ktype_id=dsms.ktypes.Datase)
item2 = KItem(name="item2", ktype_id=dsms.ktypes.Dataset, linked_kitems=[item1])

dsms.commit()

assert item1 == item2.linked_kitems[0].get()

linked kitems appear to be removed when linked to another kitem

Due to any reason, the remaining neighbours of a target kitem are loosing their relations to the target item, when this target item if linked to a source item.

E.g.
source ---linked---> target ----linked---> neighbour.

This is likely a problem in the SDK and not in the backend, since this problem

Attachment local file problem

If a new local file is assigned as attachment to a kitem and the file does not exist, there is not error thrown. This should be improved.

Linked KItems are not refreshed after commiting

When I run the following code:

item1 = KItem(
    name="Machine-1",
    ktype_id=dsms.ktypes.TestingMachine,
    custom_properties={"Producer": "TestingLab GmBH",
                       "Room Number": "A404",
                       "Description": "Bending Test Machine"
                       }
)

item2 = KItem(
    name="Machine-2",
    ktype_id=dsms.ktypes.TestingMachine,
    custom_properties={"Producer": "StressStrain GmBH",
                       "Room Number": "B500",
                       "Description": "Compression Test Machine"
                       }
)

item3 = KItem(
    name="Specimen-1", 
    ktype_id=dsms.ktypes.Specimen,
    linked_kitems=[item1],
    annotations=["https://w3id.org/steel/ProcessOntology/TestPiece"],
    custom_properties={"Geometry": "Cylindrical 150mm x 20mm x 40mm",
                       "Material": "Concrete",
                       "Project ID": "ConstructionProject2024"
    }

)
item4 = KItem(
    name="Specimen-2",
    ktype_id=dsms.ktypes.Specimen,
    linked_kitems=[item2],
    annotations=["https://w3id.org/steel/ProcessOntology/TestPiece"],
    custom_properties={"Geometry": "Rectangular 200mm x 30mm x 20mm",
                       "Material": "Metal",
                       "Project ID": "MetalBlenders2024"
                       }
)

item5 = KItem(
    name="Research Institute ABC",
    ktype_id=dsms.ktypes.Organization,
    linked_kitems=[item1,item2],
    annotations=["www.researchBACiri.org/foo"],
)

dsms.commit()

When I want to print the linked kitems of item1, I get an empty list even if was passively linked by item3. This has the reason that item1 is the first item in the updated buffer. Therefore the refresh does not have the links to item3 etc. because they will be commited after item1.

A solution would be to make a set of the kitems running through the create- and updated-commit, which would be refreshed after the overall committing operation. Currently, items get refresh after each individual commit.

Some KItem fields are not updated when an empty list is assigned

Related to the fact, that some of the kitem-properties such as "affiliation" and "contact_info" are annotated listed in the payload in the update-request as ...ToAdd or ...ToRemove, those affected properties cannot be removed but only added.

This is related to the backend and thus cannot be solved by a fix in the SDK alone.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.