Skip to content

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
it "should work" do
b1 = RDF::Node.new('b1')
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.

@elrayle elrayle force-pushed the string_results_only branch from 5857992 to 9d40709 Compare May 11, 2019 10:09
@elrayle elrayle force-pushed the string_results_only branch from 14f3b72 to 8e2dd5a Compare October 5, 2021 20:21
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.

3 participants