Closed mgh128 closed 3 years ago
Related to this issue, @dakbhavesh also asked about support for the GS1-EPCIS-extensions header to ensure that queries for user extension fields can be supported, even for implementations / repositories that are not JSON-LD aware
Adding an example here. Assume you wish to query event by userExtension field i.e. example:myField. Now, Refer example events specified at Example_9.6.1-ObjectEvent.jsonld
Two approaches to query event by userExtension field
Have @context in query payload (named or anonymous)
{
"@context": [{"example": "http://ns.example.com/epcis/"}],
"example:myField”:"Example of a vendor/user extension”
}
Have userDefined namespace as part of request header
Header:
GS1-EPCIS-extensions: example:<http://ns.example.com/epcis/>
Request Payload:
{
"example:myField”:"myValue”
}
or Url param ? example:myField=myValue
@mgh128 and @joelvogt, This seems to be important requirement to be able to query events (possibly master data too) by userExtensions fields. Once group agree to this proposal, it will also entail a change in query-schema to allow colon (:) character in generic regular expressions.
Thanks @dakbhavesh
I think you're right that the "@context" parameter needs to accept a single object or a list of URLs or objects to provide flexibility for when the mappings and namespaces are declared inline / non-persistently instead of as one or more remotely hosted context resources
Thanks @dakbhavesh and @mgh128 ! I made the changes and pushed to git
@dakbhavesh if you're happy with the changes, could you please close the issue?
Thank you very much @joelvogt! I don't have permission to close.
@mgh128 - Can you please close it?
@dakbhavesh asked if we can optionally include @context within query-schema.json to be able to support queries that make use of user-defined / vendor-defined namespaces.
@context is used to reference a JSON-LD context resource (such as https://gs1.github.io/EPCIS/epcis-context.jsonld ), which can provide namespace declarations, mappings of CURIE prefixes and aliases.
If we understand it correctly, the proposal is that a query should be able to optionally specify an "@context" parameter that expects a list or URLs of remotely hosted context resources.
EPCIS implementations/repositories that are not JSON-LD aware MAY ignore this parameter (but SHOULD allow it to be specified in a query). i.e. a query that specifies an "@context" parameter as a list of URLs should not be rejected, even if the parameter is ignored by the implementation/repository that is not JSON-LD aware.
EPCIS implementations/repositories that are JSON-LD aware SHALL interpret this parameter and use it to retrieve one or more remotely hosted JSON-LD context resources to help them to correctly process queries involving other namespaces that are defined by users, sectors, vendors etc.