Wimmics / corese

Software platform implementing and extending the standards of the Semantic Web.
https://project.inria.fr/corese/
Other
103 stars 29 forks source link

[Bug] TriG serialization of result generate incorrect triples #151

Closed MaillPierre closed 1 year ago

MaillPierre commented 1 year ago

Issue Description:

I retrieve the content of my corese dataset with a CONSTRUCT { GRAPH ?g { ?s ?p ?o } } WHERE { GRAPH ?g { ?s ?p ?o } } query, with "accept": "application/trig" as header. When constructing my KG from the content of some external sources, the TriG file returned by Corese is sometimes not valid. The brackets < and > are missing from some properties.

Bug Details:

There are no error messages on the corese side, but any parser receiving the data fails to parse the TriG content because of that.

Steps to Reproduce:

  1. Create data that generates the bug:

    INSERT DATA {
    <http://bio2rdf.org/lsr:aclame> <http://bio2rdf.org/lsr_vocabulary:x-miriam> <http://bio2rdf.org/miriam:00000063>
    }
  2. Retrieve the data in TriG format, with "accept": "application/trig" as header

    CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }
  3. The result of the CONSTRUCT query is:

    
    @prefix ns1: <http://bio2rdf.org/> .

http://bio2rdf.org/lsr:aclame http://bio2rdf.org/lsr_vocabulary:x-miriam http://bio2rdf.org/miriam:00000063 .



**Expected Behavior:**
The content of the result of the CONSTRUCT should be equivalent to the triple created.

**Note to Developers:**
My hypothesis is that the presence of a second "`:`" in the property URI messes up in some way the TriG serializer. 
This could also impact ticket #149 , and using the CONSTRUCT as I do now is already my only solution to retrieve the content of my Corese server.

**Details**
Tested on corese-server-4.4.1.jar
MaillPierre commented 1 year ago

Temporary fix was implemented using the regex:

/(\s)(([a-zA-Z0-9-]+:\/\/(([a-zA-Z0-9-]+\.)?[a-zA-Z0-9-]+)+(\.[a-zA-Z0-9\-_:]+)\/)([a-zA-Z0-9\-_:])*)(\s+)/g

replaced by:

$1<$2>$8
remiceres commented 1 year ago

Hello Pierre,

Thank you for your report. The bug has been fixed and will be available in the next release of Corese (4.4.2).