-
Notifications
You must be signed in to change notification settings - Fork 98
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
Override to_enum and enum_for on RDF module? #314
Comments
Are we expecting an What behavior are you looking for? |
I was doing some light querying over the ruby vocabularies that I have generated, and I expected that the |
Ah, yes, I see what you mean.
RDF::Vocabulary.find("http://www.w3.org/1999/02/22-rdf-syntax-ns#").each { |term| puts term }
=> #<Enumerator: ...>
RDF::Vocabulary.find("http://www.w3.org/1999/02/22-rdf-syntax-ns#").each.to_a
=> [#<RDF::Vocabulary::Term:0x2ae8de101e44 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt>,
#<RDF::Vocabulary::Term:0x2ae8de1017f0 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag>,
#<RDF::Vocabulary::Term:0x2ae8de10128c URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#List>,
#<RDF::Vocabulary::Term:0x2ae8de100d28 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#Property>,
#<RDF::Vocabulary::Term:0x2ae8de100738 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq>,
#<RDF::Vocabulary::Term:0x2ae8de1001d4 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement>,
#<RDF::Vocabulary::Term:0x2ae8de0ffc48 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#first>,
#<RDF::Vocabulary::Term:0x2ae8de0ff6e4 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#object>,
#<RDF::Vocabulary::Term:0x2ae8de0ff0f4 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate>,
#<RDF::Vocabulary::Term:0x2ae8de0feb90 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#rest>,
#<RDF::Vocabulary::Term:0x2ae8de0fe5a0 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#subject>,
#<RDF::Vocabulary::Term:0x2ae8de0fe03c URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#type>,
#<RDF::Vocabulary::Term:0x2ae8de0fdab0 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#value>,
#<RDF::Vocabulary::Term:0x2ae8de0fd54c URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML>,
#<RDF::Vocabulary::Term:0x2ae8de0fcf5c URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral>,
#<RDF::Vocabulary::Term:0x2ae8de0fc9f8 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>,
#<RDF::Vocabulary::Term:0x2ae8de0fc458 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>,
#<RDF::Vocabulary::Term:0x2ae8de0f9e4c URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#>,
#<RDF::Vocabulary::Term:0x2ae8de0f9884 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#Description>,
#<RDF::Vocabulary::Term:0x2ae8de0f9320 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#ID>,
#<RDF::Vocabulary::Term:0x2ae8de0f8d30 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#about>,
#<RDF::Vocabulary::Term:0x2ae8de0f87cc URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#datatype>,
#<RDF::Vocabulary::Term:0x2ae8de0f8268 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#li>,
#<RDF::Vocabulary::Term:0x2ae8de0f7c50 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>,
#<RDF::Vocabulary::Term:0x2ae8de0f7660 URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#nodeID>,
#<RDF::Vocabulary::Term:0x2ae8de0f70fc URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#parseType>,
#<RDF::Vocabulary::Term:0x2ae8de0f6b0c URI:http://www.w3.org/1999/02/22-rdf-syntax-ns#resource>] |
You might try RDF::RDFV.to_enum. But, setting this for RDF would probably not conflict with anything AFAIK. |
Currently when finding the RDF vocabulary a plain enumerator is returned from the
to_enum
/enum_for
instead of anRDF::Enumerable::Enumerator
:Might it make sense to override the root
to_enum
andenum_for
methods in theRDF
module and delegate toRDF::RDFV
? Themethod_missing
(in commit 16b995d) approach isn't delegating since these methods are not really missing 😉.The text was updated successfully, but these errors were encountered: