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

Support for implicit Json-Ld types #4117

Closed
jimmarino opened this issue Apr 17, 2024 · 0 comments · Fixed by #4120
Closed

Support for implicit Json-Ld types #4117

jimmarino opened this issue Apr 17, 2024 · 0 comments · Fixed by #4120
Assignees
Labels
feature_request New feature request, awaiting triage triage all new issues awaiting classification
Milestone

Comments

@jimmarino
Copy link
Contributor

jimmarino commented Apr 17, 2024

Feature Request

Often a containing object schema will define a Json-Ld @type for a child object, making the latter optional. For example:

{
  "@context":  "...",
  "@type": "dspace:ContractOfferMessage",
 
  "dspace:offer": {
    "@type": "odrl:Offer",
    "@id": "urn:uuid:d526561f-528e-4d5a-ae12-9a9dd9b7a518",
    "target": "urn:uuid:3dd1add8-4d2d-569e-d634-8394a8836a88"
  },
  
}

ContractOfferMessage defines a dspace:offer property that is always of type odrl:Offer. Specifying the @type on the policy is therefore not required.

We need a way to provide the type context information to child transformers. In the above case, JsonObjectToPolicyTransformer.

Solution Proposal

A general facility should be built into TransformerContext to provide this information generically. This can be done by adding the following methods:

    @Nullable
    default <T> T getData(String key, Class<T> expectedType) {
        return null;
    }

    @Nullable
    default <T> T setData(String key, Object data) {
        return null;
    }

    @Nullable
    default void clearData(String key) {
    }

JsonLdTransformer will then define a DEFAULT_TYPE constant transformers can use to set, access, and clear type data.

@jimmarino jimmarino added feature_request New feature request, awaiting triage triage all new issues awaiting classification labels Apr 17, 2024
@ndr-brt ndr-brt self-assigned this Apr 17, 2024
@ndr-brt ndr-brt added this to the Milestone 15 milestone Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature_request New feature request, awaiting triage triage all new issues awaiting classification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants