dbcls / LinkedData-Agora

4 stars 0 forks source link

Checking whether HTTP URIs are used is not correct #178

Closed galgonek closed 2 months ago

galgonek commented 1 year ago

The yummydata server employs the following query to check whether HTTP URIs are used:

SELECT ?s WHERE {
  GRAPH ?g {
    ?s ?p ?o .
    FILTER(!(STRSTARTS(str(?s), "http://www.openlinksw.com/") ||
            STRSTARTS(str(?s), "http://www.w3.org/") ||
            STRSTARTS(str(?s), "http://xmlns.com/")) &&
        (STRSTARTS(str(?s), "http") || STRSTARTS(str(?s), "HTTP")) &&
        ?g NOT IN (<http://www.openlinksw.com/schemas/virtrdf#>))
  }
}
LIMIT 10

Unfortunately, this query is not correct as a standard-compliant SPARQL server does not return any result for this query.

According to the SPARQL 1.1 standard (https://www.w3.org/TR/sparql11-query/#defn_evalGraph), the graph pattern is evaluated as follows: for each graph in a dataset, the child pattern of the graph patern is evaluated first and only then the obtained solutions are joined with the solution that binds the graph variable to the graph IRI. It follows that during the evaluation of the filter, the g variable is not bound yet. It means that the filter can be never true, if it is evaluated by a standard-compliant SPARQL server.

The query should properly be something like this:

SELECT ?s WHERE {
  GRAPH ?g {
    ?s ?p ?o .
    FILTER(!(STRSTARTS(str(?s), "http://www.openlinksw.com/") ||
            STRSTARTS(str(?s), "http://www.w3.org/") ||
            STRSTARTS(str(?s), "http://xmlns.com/")) &&
        (STRSTARTS(str(?s), "http") || STRSTARTS(str(?s), "HTTP")))
  }
  FILTER(?g NOT IN (<http://www.openlinksw.com/schemas/virtrdf#>))
}
LIMIT 10
yayamamo commented 1 year ago

Thank you for your suggestion! We will modify the code soon.

galgonek commented 8 months ago

Dear @yayamamo, is there any progress in solving this issue, please? Thank you very much in advance for your answer.

yayamamo commented 8 months ago

@galgonek Sorry for my late response. We have difficulty in securing our budget to take care of issues concerning YummyData.org. We are expecting to address this issue by March next year.

yayamamo commented 2 months ago

@galgonek Now we took care of our code to follow your suggestion. Thank you for your contribution.