dajobe / raptor

Redland Raptor RDF syntax library
https://librdf.org/raptor/
Other
156 stars 62 forks source link

error converting lists from ntriples to turtle #64

Open KonradHoeffner opened 9 months ago

KonradHoeffner commented 9 months ago

Input file list.nt

_:genid1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <https://test.com/A> .                  
_:genid1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:genid2 .  
_:genid2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <https://test.com/B> .                         
_:genid2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . 

Validation

$ rapper -i ntriples -c list.nt
rapper: Parsing URI file:///home/konrad/tmp/list.nt with parser ntriples
rapper: Parsing returned 4 triples

Conversion

$ rapper -i ntriples -o turtle list.nt > list.ttl
rapper: Parsing URI file:///home/konrad/tmp/list.nt with parser ntriples
rapper: Serializing with serializer turtle
rapper: Parsing returned 4 triples

Note that there is no error at this point.

Error

$ cat list.ttl
  @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

  [](<https://test.com/A>
      <https://test.com/B>
  ) .

$ rapper -i turtle -c list.ttl                   
rapper: Parsing URI file:///home/konrad/tmp/list.ttl with parser turtle
rapper: Error - URI file:///home/konrad/tmp/list.ttl:2 - syntax error, unexpected (, expecting .
rapper: Failed to parse file list.ttl turtle content
rapper: Parsing returned 0 triples

Environment

$ pacman -Ss raptor 
extra/raptor 2.0.16-3 [installed]
    A C library that parses RDF/XML/N-Triples into RDF triples
$ uname -a
Linux archlinux 6.6.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 20 Nov 2023 23:18:21 +0000 x86_64 GNU/Linux

Real Example

This is just a minimum working example, I found the error while converting anno.ttl attached in the archive anno.zip from turtle to turtle. After rapper -i turtle -o turtle anno.ttl > anno.ttl there are a lot of broken parts like this one:


(:Bone
    :BoneCompound
    :BonePart
) .