-
Notifications
You must be signed in to change notification settings - Fork 5
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
JsonLdModule error #7
Comments
Hi, I don't really have much experience with Android development, but from what I've gathered, this could be an issue with Java version. You need to use Java 8 with JB4JSON-LD.
|
It worked, thanks! now I face another problem, I defined my User class as:
but when I print the json-dl it just prints a normal json file, I guess that the problem is how I configure the JsonLdModule but I am not sure how I can do it, can you share any documentation or example code? it seems that it does not recognise the Annotations in the class. This is my code:
and I get the same output:
|
Hey, this is an interesting issue. I did some experimenting and it looks like once you use the If you move the first User u = new User("Paco");
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonLdModule module = new JsonLdModule();
module.configure(ConfigParam.SCAN_PACKAGE, "cz.cvut.kbss.jopa.jsonld");
mapper.registerModule(module);
System.out.println(mapper.writeValueAsString(u)); If you want to have both JSON and JSON-LD serialization, you will need two mappers. |
Hi btw, I saw that you are working a lot with semantic, I have an RDF schema and I want to create java classes automatically (similar to https://github.com/kbss-cvut/jopa-examples/blob/master/jsonld/src/main/java/cz/cvut/kbss/jopa/jsonld/model/User.java) do you know any tool to help me with that? |
You're welcome, glad to help. Well, we have JOPA, which is a persistence layer over semantic data. It supports generation of Java model, but the generator is based on OWL integrity constraints. |
Thanks for your help! I think that JOPA is a powerful tool, we are making an ontology so we will use it. It says these classes are generated by OWL2Java automatically but I do not see how to use OWL2Java btw, your paper is interesting, good job! |
Thanks for taking interest in JOPA and in the paper. As for the example01, the classes in the package you reference are written manually. However, if you run |
I am trying to get the classes but I get this error:
I checked maven version, I use JDK now (I used JRE before), besides I downloaded the tools.jar in the directory. Did not work :( (I use JAVA 12) I took all the examples and I execute maven ( if I execute may it be a missing dependency?? |
Hi, no, this is not a missing dependency. You have to use JDK 8 to build JOPA-based applications. This is because the aspectj-maven-plugin we use to weave aspects into entity classes currently does not support later versions of Java. There is an issue for this in the JOPA repository with a workaround... |
Hi, thanks for the quick reply! I just realized that the classes were built! (anyway I will use JAVA 8 from now).
if I want to use my ontology, I guess I should change this and the mapping file, right? |
Yeah, basically, the mapping file is there to allow loading locally stored ontologies referenced by a URL. So, taking the configuration of example01, there is no ontology |
Hi,
I am working with json-ld in android and I want to transform a Java class to a json-dl file, I try to create the ObjectMapper with the
JsonLdModule
but I face a problem I do not understand problem, I know that there is not a problem with the definition of the class as the error comes from this code:I followed that: https://github.com/kbss-cvut/jopa-examples/blob/master/jsonld/src/main/java/cz/cvut/kbss/jopa/jsonld/config/RestConfig.java#L37
The code runs in a Thread inside to a Service.
This is the error:
Any ideas of the problem? and any sugestions of my code?
I try to do something similar to this example: https://github.com/kbss-cvut/jopa-examples/tree/master/jsonld
The text was updated successfully, but these errors were encountered: