lib/rdf/turtle/reader.rb in rdf-turtle-0.3.2 vs lib/rdf/turtle/reader.rb in rdf-turtle-1.0.0

- old
+ new

@@ -137,17 +137,17 @@ # [9] verb ::= predicate | "a" production(:verb) do |reader, phase, input, current, callback| input[:predicate] = current[:resource] if phase == :finish end - # [10] subject ::= IRIref | blank + # [10] subject ::= IRIref | BlankNode | collection production(:subject) do |reader, phase, input, current, callback| current[:triples] = nil if phase == :start input[:subject] = current[:resource] if phase == :finish end - # [12] object ::= iri | blank | blankNodePropertyList | literal + # [12] object ::= iri | BlankNode | collection | blankNodePropertyList | literal production(:object) do |reader, phase, input, current, callback| next unless phase == :finish if input[:object_list] # Part of an rdf:List collection input[:object_list] << current[:resource] @@ -155,22 +155,22 @@ callback.call(:trace, "object", lambda {"current: #{current.inspect}"}) callback.call(:statement, "object", input[:subject], input[:predicate], current[:resource]) end end - # [15] blankNodePropertyList ::= "[" predicateObjectList "]" + # [14] blankNodePropertyList ::= "[" predicateObjectList "]" production(:blankNodePropertyList) do |reader, phase, input, current, callback| if phase == :start current[:subject] = reader.bnode elsif input[:triples] input[:subject] = current[:subject] else input[:resource] = current[:subject] end end - # [16] collection ::= "(" object* ")" + # [15] collection ::= "(" object* ")" production(:collection) do |reader, phase, input, current, callback| if phase == :start current[:object_list] = [] # Tells the object production to collect and not generate statements else # Create an RDF list @@ -189,10 +189,10 @@ # Return bnode as resource input[:resource] = bnode end end - # [17] RDFLiteral ::= String ( LanguageTag | ( "^^" IRIref ) )? + # [16] RDFLiteral ::= String ( LanguageTag | ( "^^" IRIref ) )? production(:RDFLiteral) do |reader, phase, input, current, callback| next unless phase == :finish opts = {} opts[:datatype] = current[:resource] if current[:resource] opts[:language] = current[:lang] if current[:lang]