Class: Reddy::N3Parser
- Inherits:
-
Object
- Object
- Reddy::N3Parser
- Defined in:
- lib/reddy/n3parser.rb
Instance Attribute Summary collapse
-
#graph ⇒ Object
Returns the value of attribute graph.
Instance Method Summary collapse
-
#initialize(n3_str, uri = nil) ⇒ N3Parser
constructor
Creates a new parser for N3 (or Turtle).
Constructor Details
#initialize(n3_str, uri = nil) ⇒ N3Parser
Creates a new parser for N3 (or Turtle).
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/reddy/n3parser.rb', line 17 def initialize(n3_str, uri=nil) @uri = Addressable::URI.parse(uri) unless uri.nil? parser = N3GrammerParser.new document = parser.parse(n3_str) if document @graph = Graph.new process_directives(document) process_statements(document) else parser.terminal_failures.each do |tf| puts "Expected #{tf.expected_string.inspect} (#{tf.index})- '#{n3_str[tf.index,10].inspect}'" end end end |
Instance Attribute Details
#graph ⇒ Object
Returns the value of attribute graph.
8 9 10 |
# File 'lib/reddy/n3parser.rb', line 8 def graph @graph end |