Skip to content

Instantly share code, notes, and snippets.

@no-reply
Last active August 16, 2016 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save no-reply/304849a58688a2ff4ac66c0b47455121 to your computer and use it in GitHub Desktop.
Save no-reply/304849a58688a2ff4ac66c0b47455121 to your computer and use it in GitHub Desktop.
require 'rdf'
require 'rdf/spec'
statements = RDF::Spec.quads
statements.extend(RDF::Enumerable, RDF::Queryable)
statements.count # => 95
pattern = RDF::Query::Pattern.new(nil, nil, nil, graph_name: false)
statements.send(:query_pattern, pattern).count # => 95
with_graph = statements.select { |st| st.graph_name }
with_graph.count # => 20
pattern === with_graph.first # => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment