pchampin / sophia_rs

Sophia: a Rust toolkit for RDF and Linked Data
Other
210 stars 23 forks source link

Collection parsing fails with XML #76

Closed phillord closed 7 months ago

phillord commented 4 years ago

I am having a problem with parsing of collections.

Consider the following RDF:

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
            xmlns:ex="http://example.org/stuff/1.0/">

  <rdf:Description rdf:about="http://example.org/basket">
    <ex:hasFruit rdf:parseType="Collection">
      <rdf:Description rdf:about="http://example.org/banana"/>
      <rdf:Description rdf:about="http://example.org/apple"/>
      <rdf:Description rdf:about="http://example.org/pear"/>
      <!--rdf:Description rdf:about="http://example.org/conference_pear">
      </rdf:Description-->
    </ex:hasFruit>
  </rdf:Description>
</rdf:RDF>

When I parse this using horned-triples (my own code):

https://github.com/phillord/horned-owl/blob/master/src/bin/horned-triples.rs

I get:

http://example.org/basket
    http://example.org/stuff/1.0/hasFruit
    n0
n0
    http://www.w3.org/1999/02/22-rdf-syntax-ns#first
    http://example.org/banana
n0
    http://www.w3.org/1999/02/22-rdf-syntax-ns#rest
    n1
n1
    http://www.w3.org/1999/02/22-rdf-syntax-ns#first
    http://example.org/apple
n1
    http://www.w3.org/1999/02/22-rdf-syntax-ns#rest
    n2
n2
    http://www.w3.org/1999/02/22-rdf-syntax-ns#first
    http://example.org/pear
n2
    http://www.w3.org/1999/02/22-rdf-syntax-ns#rest
    http://www.w3.org/1999/02/22-rdf-syntax-ns#nil

which seems correct. But remove the commented XML which should add another fruit and I get:

http://example.org/basket
    http://example.org/stuff/1.0/hasFruit
    http://example.org/conference_pear

Alas my basket is empty! I was expecting it to be one longer.

pchampin commented 4 years ago

@phillord thanks for the report.

@althonos you wrote the RDF/XML parser. Would you have time to take a look at this?

pchampin commented 3 years ago

Is this solved in v0.6.0?

pchampin commented 3 years ago

@phillord up

Is this solved in v0.6.0?

pchampin commented 7 months ago

fixed in 0.8

(test it here)