Class: Reddy::ConjunctiveGraph
- Defined in:
- lib/reddy/conjunctive_graph.rb
Overview
ConjunctiveGraph - The top level container for all named Graphs sharing a Store
A ConjuctiveGraph is a graph that can contain other graphs. Graphs are kept distinct by a context, which is the identifier of the sub-graph. It is the union of all graphs in a Store.
For the sake of persistence, Conjunctive Graphs must be distinguished by identifiers (that may not necessarily be RDF identifiers or may be an RDF identifier normalized - SHA1/MD5 perhaps - for database naming purposes ) which could be referenced to indicate conjunctive queries (queries made across the entire conjunctive graph) or appear as nodes in asserted statements. In this latter case, such statements could be interpreted as being made about the entire ‘known’ universe.
Instance Attribute Summary
Attributes inherited from Graph
#identifier, #nsbinding, #store, #triples
Instance Method Summary collapse
-
#default_context ⇒ Object
The default_context is a Graph having an identifier the same as the identifier of the store.
-
#initialize(options = {}) ⇒ ConjunctiveGraph
constructor
Store for ConjunctiveGraph must support contexts.
-
#parse(stream, uri, options = {}, &block) ⇒ Graph
Parse source into a new context.
Methods inherited from Graph
#<<, #[], #add, #add_triple, #bind, #bnodes, #close, #commit, #contains?, #context_aware?, #destroy, #eql?, #get_by_type, #has_bnode_identifier?, #inspect, #merge!, #namespace, #objects, #open, #predicates, #prefix, #remove, #rollback, #size, #subjects, #to_ntriples, #to_rdfxml, #to_s
Constructor Details
#initialize(options = {}) ⇒ ConjunctiveGraph
Store for ConjunctiveGraph must support contexts.
16 17 18 19 20 21 22 23 |
# File 'lib/reddy/conjunctive_graph.rb', line 16 def initialize( = {}) unless [:store] && [:store].context_aware? raise GraphException.new("Conjuective Graph requires store supporting contexts") end super(:identifier => [:store].identifier, :store => [:store]) @context_aware = true end |
Instance Method Details
#default_context ⇒ Object
The default_context is a Graph having an identifier the same as the identifier of the store.
27 28 29 |
# File 'lib/reddy/conjunctive_graph.rb', line 27 def default_context @@default_context = Graph.new(:identifier => @store.identifier, :store => @store) end |
#parse(stream, uri, options = {}, &block) ⇒ Graph
Parse source into a new context.
Create a new context (Graph) and parse into that.
- options[:debug]
-
Array to place debug messages
- options[:type]
-
One of rdfxml, html, or n3
- options[:strict]
-
Raise Error if true, continue with lax parsing, otherwise
42 43 44 45 |
# File 'lib/reddy/conjunctive_graph.rb', line 42 def parse(stream, uri, = {}, &block) # :yields: triple graph = Graph.new(:identifier => uri, :store => self.store) Parser.parse(stream, uri, .merge(:graph => graph), &block) end |