Class: RdfContext::QuotedGraph
- Defined in:
- lib/rdf_context/quoted_graph.rb
Overview
QuotedGraph - Supports N3 Formulae.
QuotedGraphs behave like other graphs, except that the triples are not considered for inference rules and their statements are not held has truth. Triples from a QuotedGraph are not returned from a ConjunctiveGraph in the same store space.
Within N3, a QuotedGraph is represented as a set of statements contained between _and __
{ [ x:firstname "Ora" ] dc:wrote [ dc:title "Moby Dick" ] } a n3:falsehood .
Instance Attribute Summary
Attributes inherited from Graph
#allow_n3, #identifier, #store, #triples
Instance Method Summary collapse
-
#add(*triples) ⇒ Graph
Adds one or more extant triples to a graph.
-
#n3 ⇒ String
Return an n3 identifier for the Graph.
Methods inherited from Graph
#<<, #==, #[], #add_seq, #add_triple, #bind, #bnodes, #close, #commit, #contains?, #context_aware?, #destroy, #get_by_type, #graph?, #has_bnode_identifier?, #hash, #initialize, #inspect, #isomorphic?, #merge!, #namespace, #nsbinding, #objects, #open, #parse, #predicates, #prefix, #properties, #qname, #remove, #rollback, #seq, #serialize, #size, #subjects, #sync_properties, #to_ntriples, #to_rdfxml, #to_s, #type_of, #uri_binding
Methods inherited from Resource
#bnode?, #graph?, #literal?, parse, #resource?, #uri?
Constructor Details
This class inherits a constructor from RdfContext::Graph
Instance Method Details
#add(*triples) ⇒ Graph
Adds one or more extant triples to a graph. Delegates to Store.
24 25 26 27 28 29 |
# File 'lib/rdf_context/quoted_graph.rb', line 24 def add(*triples) = triples.last.is_a?(Hash) ? triples.pop : {} ctx = [:context] || @default_context || self triples.each {|t| @store.add(t, ctx, true)} self end |
#n3 ⇒ String
Return an n3 identifier for the Graph
33 34 35 |
# File 'lib/rdf_context/quoted_graph.rb', line 33 def n3 "{#{self.identifier.to_n3}}" end |