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

Provide an example of how to use inside Java #168

Open
berezovskyi opened this issue May 6, 2021 · 3 comments
Open

Provide an example of how to use inside Java #168

berezovskyi opened this issue May 6, 2021 · 3 comments

Comments

@berezovskyi
Copy link

We currently have the following code from 0.0.87 (trying to update to the latest version of shaclex since Bintray disappearance to use your GH Maven repo):

Result result = validateInternal(dataModel, shapeModel);
final RDFReader valReport = result.validationReport().right().get();
Either<String, String> valReportAsTurtle = valReport.serialize(RDFLanguages.strLangTurtle);

I am trying to convert it to use cats resource but so far I have been unable to lift the instance of the RDFBuilder from the Resource:

Result result = validateInternal(dataModel, shapeModel);

IO<Resource<IO, RDFAsJenaModel>> emptyModel = RDFAsJenaModel$.MODULE$.empty();
Resource<IO, RDFAsJenaModel> jenaModelResource = emptyModel.unsafeRunSync(IORuntime.global());
final RDFReader valReport = result.validationReport().toRDF(jenaModelResource???);

Either<String, String> valReportAsTurtle = valReport.serialize(RDFLanguages.strLangTurtle);

Could you please help us with an example or point me to the right place in the cats documentation where I can find some guidance?

I was using https://www.weso.es/srdf/docs/srdfJena as a guidance but RDFAsJenaModel.empty instance does not have a method use as shown in the docs (at least not in the JVM signature, maybe it was generated to another class).

Thanks in advance!

@thewillyhuman
Copy link
Member

@labra any thought? The problem mentioned inside the issue eclipse-lyo/lyo#98 looks very similar to the one that @mistermboy suffered last week with the Ontolo-CI dependencies.

SHACLex library is no longer available from Bintray because it shut down

@labra
Copy link
Member

labra commented May 15, 2021

I am planning to create an example java project invoking shaclex.

@berezovskyi, what Java version do you use? Because I think we require Java 11 or above, does that work for you?

I also think the best way to use the library from Java is to avoid using directly cats features like IO or Resource. For that, one approach we used in another project is to provide a simple wrapper for Java that invokes the library.

I will create a simple Java project that shows how to invoke the library in Java in the next days.

@berezovskyi
Copy link
Author

Thank you, Jose!

We use JDK 11 but try to target Java 1.8 for max compat but Jena is already pushing us to Java 11 with their last release. So, shaclex pushing us to Java 11 target will be just another step in that direction :)

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

3 participants