-
Notifications
You must be signed in to change notification settings - Fork 22
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
Feature/query syntax to force namespace expansion in query results #395
Comments
The json-ld spec mentions "clearing" the context by setting it to null during the discussion of |
Is the idea that when a user requests expansion we return fully expanded json-ld? Should the |
Actually, is the intent to have a fully expanded query response?
Or some sort of hybrid expansion? If it's a hybrid, what things do we want expanded and which do we want to leave in compact form? |
There should be no "expanding" necessary - Fluree stores everything fully expanded, it is really you are just not "compacting" anything. So unless someone requested @id be compacted to id, then it shouldn't be touched. |
Your example is expanded, can you be specific about what you mean? An error in your example is rdf:type is always an IRI - so it should not use @value, which in this case would be interpreted as a string. You can just output the string itself, as RDF already says this is an IRI... or instead use @id - either would be fine and both would still be 'expanded'. Basically what we should do here is simply not 'compact' anything, as there is no context to compact with. Everything else should return as it does today. I think we should add an option to always return datatypes, which we don't today, but that would be a different ticket. |
Good eye on the rdf:type error. I was providing the expanded example to contrast with the expanded example in the acceptance criteria, which still features the compacted Also, should we translate the type iri to |
There is no Likewise, Fluree only uses |
I've got context clearing with When we assemble query results, we don't build them as fully expanded json-ld, we build and compact each property as we process the ;; fully expanded json-ld
[{"@id" "http://example.com/dan",
"http://example.com/x" [{"@value" 1}],
"http://example.com/y" [{"@value" "y"}]}]
;; what we currently return
[{"@id" "http://example.com/dan",
"http://example.com/x" 1,
"http://example.com/y" "y"}] A
For 2) I think we would need a |
I mentioned this scenario above and said we should create a ticket that also returns, as an option, all datatypes. Your example contrasting the two return options isn't a good one - both are technically identical in JSON-LD. There are examples where it would make sense... this just isn't one of them. You'd only need to include @value if you also needed to include @type. Strings and integers are auto-inferred, so it is only needed for data types other than those two, and technically IRIs assuming you used @id (or per spec they are always IRS, like @id and @type always are). Often those data types can be summarized in an @context also returned, eliminating the need to constantly repeat @type when they are all the same and needing to not include @value at all -- which would eliminate much of this need altogether. Anyhow, a topic for another ticket. |
Going to wait until the fix for #414 lands to complete this. |
I've got a mostly-complete fix in #422 , but that PR doesn't add proper tests for this issue and just introduces the functionality from fluree/json-ld#14 |
Description
A default context for a ledger will, by default, namespace query results according to that default context. So if
"schema": "http://schema.org/
is part of the default context, and a query is issued that returns results with properties/values within thehttp://schema.org/
namespace, those properties/values will be namespaced asschema:...
by default.There should be an option expressed as query syntax for flagging a desire to return results without any default namespacing from the default context.
An example of this can be described by the following ledger & txns & queries:
If my ledger's default context looks like
And if I issue a commit like
A query such as this...
...returns this:
There is a use case for wanting to not perform all default namespace shortening and to instead return query results in an expanded form regardless of default context, e.g. a query like...
...and results like...
Acceptance Criteria
Implementation Details
The text was updated successfully, but these errors were encountered: