ruby-rdf / rdf-rdfxml

Ruby RDF/XML reader/writer for RDF.rb.
http://rubygems.org/gems/rdf-rdfxml
The Unlicense
17 stars 7 forks source link

[Writer] prefixes (namespaces) are not used to output subjects #15

Closed abrisse closed 12 years ago

abrisse commented 12 years ago

Hi,

Namespaces set for the writer should be used not only to match predicates (with function get_qname) but subjects too. I haven't checked for objects but the behaviour should be the same.

Example :

RDF::RDFXML::Writer.open('freebase.owl', :prefixes => {:fb, RDF::URI.new('http://example.com/ns/')}) do |writer|
    writer << repository
end

The statement

<http://example.com/ns/Concept> a owl:Class

should be output

<ns0:Class rdf:about="fb:Concept" />

instead of

<ns0:Class rdf:about="http://example.com/ns/Concept" />
gkellogg commented 12 years ago

RDF/XML uses full URIs for rdf:about. NCNames are only used for property elements. Just one reason why RDF/XML sucks.

See http://www.w3.org/TR/REC-rdf-syntax/#aboutAttr for the grammar rule.

abrisse commented 12 years ago

Thanks for the explanation Gregg.