Skip to content
This repository has been archived by the owner on Dec 21, 2017. It is now read-only.

Commit

Permalink
Further work on parser
Browse files Browse the repository at this point in the history
  • Loading branch information
tommorris committed Jun 19, 2008
1 parent 663f65b commit 146bf57
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/rdfxmlparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def initialize (xml_str)
@xml.root.each_element { |e|
self.parse_element e
}
puts @graph.size
# puts @graph.size
end
end

Expand All @@ -32,20 +32,22 @@ def is_valid_uriref?

protected
def parse_element (element)
puts "Invoked!"
# puts "Invoked!"
subject = "" # declare so it works outside block
type = URIRef.new(element.namespace + element.name)
element.attributes.each_attribute { |att|
uri = att.namespace + att.name
value = att.to_s
# puts uri + " --> " + value
if uri == "http://www.w3.org/1999/02/22-rdf-syntax-ns#resource"
subject = URIRef.new(value)
subject = value
# TODO: add other subject types here! - ID, nodeID etc.
else
@graph.add_triple(subject, uri, value)
@graph.add_triple(URIRef.new(subject), uri, value)
end
}
puts type
puts subject
# puts type
if type.to_s == "http://www.w3.org/1999/02/22-rdf-syntax-ns#Description"
# do nothing
else
Expand Down

0 comments on commit 146bf57

Please sign in to comment.