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

Allow limiting returned results to xsd:string #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elrayle
Copy link
Contributor

@elrayle elrayle commented May 11, 2019

ruby-rdf/rdf Literal#has_datatype? specifically ignores Literals of the xsd:string type. The #plain method checks for string type. So that can be used to check if this is a string and also compare datatype to type if it is. This allows for limiting returned results to strings.

I suspect that the default type is xsd:string. So this may allow more matches than is desired. But without this test change, there are 0 matches when filtering for xsd:string.

I added an issue to ruby-rdf/rdf to ask about the reason for excluding xsd:string. See issue ruby-rdf/rdf#396 for more information.

@elrayle elrayle self-assigned this May 11, 2019
@elrayle elrayle requested a review from cbeer May 11, 2019 00:12
@elrayle elrayle force-pushed the string_results_only branch 2 times, most recently from 3135360 to 5857992 Compare May 11, 2019 00:26
graph << [object, RDF::Vocab::DC.title, "Hello, world!"]
graph << [object, RDF::Vocab::DC.title, b1]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding in a blank node to the title because there needs to be something other than string for test differentiation.

uri if (uri.has_datatype? && uri.datatype == type) || (uri.plain? && string_type?(type))
end

def string_type? type
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a private method?

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

Successfully merging this pull request may close these issues.

None yet

2 participants