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

optionally return results as literals #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

elrayle
Copy link
Contributor

@elrayle elrayle commented Nov 20, 2019

Fixes #16 Optionally have ldpath return RDF::Literals instead of Strings

DEFAULT remains returning results as string or the specified data type

Also...
* remove pin of bundler
* add example results to README

@jrochkind
Copy link
Contributor

Should there be docs somewhere documenting the new param and what it does? Either method-level comment docs on the methods that take the new arg, or README, or something?

I had trouble figuring out what it did at first looking at the code -- is it the difference between returning a String (?) and an RDF::Literal object? Should we think about if there's a clearer name for that then maintain_literals, since once it's released it'll be hard to change? (There may not be a clearer name).

@@ -36,7 +36,7 @@ context = RDF::Graph.new << [uri, RDF::Vocab::DC.title, "Some Title"]

program = Ldpath::Program.parse my_program
output = program.evaluate uri, context: context
# => { ... }
# => {"title"=>["Some Title"]}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the expected result should be for documentation purposes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That documents the normal case, but the thing being added in this PR with maintain_literals is still (I think?) entirely undocumented. As the simplest possible thing, since ldpath doesn't seem super documented in general anyway but that's not a problem for this PR, what about just adding antoher examples to the README with maintain_literals: true, and what that would return?

Also, just confirm you think maintain_literals is the right name of this arg? Preferable to, oh, use_literals or return_literals or return_rdf_literals or rdf_literals: true or something like that? I think it's up to you, I just think it's good to at least publicly consider if it's the best one we can think of before locking it into a release from which it can't be changed without backwards incompat.

I'm not totally locked into any of these ideas, just trying my best to give a responsible non-rubberstamping review on code I'm not actually at all familiar with. Disagreement welcome you can just tell me "nah, I know this code better and it's right how it is", and I'll just approve! Thanks!

DEFAULT remains returning results as string or the specified data type

Also...
* remove pin of bundler
* add example results to README
else
v
end
end

def same_type(object, field_type)
Copy link
Contributor

@jcoyne jcoyne Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be same_type? Should it be a private method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optionally have ldpath return RDF::Literals instead of Strings
3 participants