Skip to content
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

Python Client development #14

Open
berezovskyi opened this issue Feb 13, 2021 · 7 comments
Open

Python Client development #14

berezovskyi opened this issue Feb 13, 2021 · 7 comments

Comments

@berezovskyi
Copy link

Hi,

Congratulations on the Python OSLC SDK release! I see it's mostly focused on developing OSLC servers in Python. Have you tried reusing the models you developed to create OSLC clients in Python? I see you already use rdflib and requests internally.

Cheers from the Eclipse Lyo SDK team,
Andrew 👋

@fpatz
Copy link
Member

fpatz commented Feb 15, 2021

We definitely plan to have a client side SDK.

@mjohn6606
Copy link

Has there been progress on the reusing of models to create OSLC clients in Python? I'm looking to use Python OSLC SDK release for my work the same way that I can use the Eclipse OSLC client.

Thanks for any information,
Marc

@fpatz
Copy link
Member

fpatz commented Jun 2, 2021

Thanks for your interest, @mjohn6606. We do not expect to work on the client side SDK before before winter, the server SDK is still not complete and we're refactoring the APIs right now.

@mjohn6606
Copy link

Thanks for your earlier answer. My colleague @rushmie and I would like to specify our own resource definitions and vocabularies in PyOSLC. Is there information on how to do this? Do we just define our own abstract resource and vocabulary for it and it will show up in the Flask app? Any help would be greatly appreciated.
We currently are running PyOSLC in Python 3.7 with no problems.

Thanks! Marc

@isccarrasco
Copy link
Collaborator

Hello @mjohn6606,
We still working in some adjustments in the project to do this easier.

In your implementation, you might add your vocabulary in the pyoslc.vocabularies package or create your own package to create your vocabulary definition, here is an example of the RM vocabulary.

Next, you can add your resource definition by extending the ResourceBase class that is in the pyosl.resources.models, the ResourceBase contains the main attributes of an OSLC Resource.

In your business implementation you can then instantiate your resources and use your vocabulary to create the responses.

Regards!

@rushmie
Copy link

rushmie commented Jul 2, 2021

@isccarrasco

Thanks for your help. Just to clarify, we have developed an OSLC domain specification that extends the Core specification in the Eclipse Lyo environment. We are exploring using python as an alternative because our environment prefers Python over Java. It contains new classes that are specific to our data and purposes.

We should be able to add those classes and properties we have defined in our Lyo specification into a new vocabulary python file correct?

Then we need to define the resource structure by adding classes that extend the Resource Base class. Do those reside in pyoslc.domains files? I see that there is a Requirement class already defined in pyoslc/domains/rm.py. So we might just add all of our new classes in its own domain. Is it necessary to define all of the conversion (to rdf, to json etc) functions to our class definitions?

@isccarrasco
Copy link
Collaborator

Hello @rushmie,

Yes, you can add your vocabulary in the pyoslc.vocabulary package, as you can see, there are some different vocabularies defined in this package.

The resource definition are in the package pyoslc.resources.domain, you can add there the new file with the definition of your resource.

For now the methods to_rdf and to_json need to be implemented in the resource class since the mapping of the attributes for the resource is defined using an external dictionary (this is something that we are trying to improve).

@rushmie, @mjohn6606, can we continue this discussion in a new issue?, can you please open a new issue, since this issue is related to the OSCL Client :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants