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

Reprogen: Improve Datatype annotation. #21

Open
Aklakan opened this issue Sep 20, 2024 · 1 comment
Open

Reprogen: Improve Datatype annotation. #21

Aklakan opened this issue Sep 20, 2024 · 1 comment

Comments

@Aklakan
Copy link
Member

Aklakan commented Sep 20, 2024

The Datatype annotation can be used to map Java objects to RDF types, such as Java int to xsd:gYear. Shacl requires namespaces to be provided as literals of type xsd:anyUri. The following does not work, probably due to a missing type mapping:

  @Datatype("http://www.w3.org/2001/XMLSchema#anyUri")
  String setIri(String str);
@Aklakan
Copy link
Member Author

Aklakan commented Sep 22, 2024

In general, there should be support for lenient reads: if the existing data uses xsd:string instead of xsd:anyURI, the getIri method should still be capable of matching the datatype.

Perhaps the read methods should be annotated with all the datatypes they should be able to read, whereas the write method is annotated with the canonical datatype.

This would allow for implementing the "robustness principle": be liberal in what you accept and conservative in what you send.
In short: Lenient read / canonical (or strict) write.

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

1 participant