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.46 MB

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

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

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

dsms-python-sdk's Introduction

DSMS-SDK

Python SDK core-package for interacting with the Dataspace Management System (DSMS)

Authors

Matthias Büschelberger (Fraunhofer Institute for Mechanics of Materials IWM)

Yoav Nahshon (Fraunhofer Institute for Mechanics of Materials IWM)

Pablo De Andres (Fraunhofer Institute for Mechanics of Materials IWM)

License

This project is licensed under the BSD 3-Clause. See the LICENSE file for more information.

Usage

The SDK provides a general Python interface to a remote DSMS deployment, allowing users to access, store and link data in a DSMS instance easily and safely. The package provides the following main capabilities:

  • Managing Knowledge-Items (KItems), which are data instances of an explicitly defined semantic class type (KType)
  • Creating, updating and deleting meta data and properties, e.g. date, operator, material response data for a conducted tensile test
  • Administrating authorship, contact information and supplementary information upon making changes or adding KItems
  • Semantic annotation of KItems
  • Conduct simple free-text searches within the DSMS instance including filters (e.g. limiting the search for certain materials) as well as a more experts-aware SPARQL interface
  • Linking KItems to other KItems
  • Linking Apps to KItems, triggererd, for example, during a file upload
  • Performing simple file upload and download using attachments to KItems
  • Export of a knowledge (sub) graph as common serializations (.ttl, .json)

For the basic usage, please have a look on the Jupyter Notebook under examples/basic_usage.ipynb. This tutorial provides a basic overview of using the dsms package to interact with Knowledge Items.

Disclaimer

Copyright (c) 2014-2024, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. acting on behalf of its Fraunhofer IWM.

Contact: Matthias Büschelberger

dsms-python-sdk's People

Contributors

mbueschelberger avatar

Stargazers

 avatar

Watchers

 avatar

dsms-python-sdk's Issues

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

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)

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.

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.

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.

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.

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()

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.