AtomGraph / LinkedDataHub

The low-code Knowledge Graph application platform. Apache license.
https://atomgraph.github.io/LinkedDataHub/
Apache License 2.0
485 stars 122 forks source link

Data column(s) for axis #0 cannot be of type string #142

Closed FNakano closed 1 year ago

FNakano commented 1 year ago

Hi! This might be related to #139. I'm working with develop branch. The query


prefix cdt: <http://w3id.org/lindt/custom_datatypes#ucum>
prefix sosa: <http://www.w3.org/ns/sosa/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix dc: <http://purl.org/dc/elements/1.1/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix owl: <http://www.w3.org/2002/07/owl#>

select * where {
  ?s ?p sosa:Observation .
  ?s sosa:hasSimpleResult ?o .
  ?s sosa:resultTime ?o1 .
} LIMIT 100

was run and produced a table. I wanted to see if it could produce a chart.

Changed category to o1, series to o and chart type to scatter chart. Got the message: Data column(s) for axis #0 cannot be of type string. Other chart types result in similar messages. Maybe I'm missing something... This might affect other units and datatypes (xsd, cdt, qudt, ...) Is there something I can do?

Captura de tela de 2022-11-02 17-09-07

namedgraph commented 1 year ago

From what I can see in #139 the objects of sosa:hasSimpleResult are not numbers in the XSD sense, therefore they cannot be charted. You need to strip the hPa string and then cast the resulting string to xsd:float. Something like (untested):

BIND(xsd:float(STRBEFORE(?o, ' ')) as ?oFloat)

and then use ?oFloat instead.

namedgraph commented 1 year ago

@FNakano did this help?

FNakano commented 1 year ago

I'm sorry, I didn't test it yet, @namedgraph , I will test it this week and post results here.

FNakano commented 1 year ago

@namedgraph, I tried to test:

prefix cdt: <http://w3id.org/lindt/custom_datatypes#ucum>
prefix sosa: <http://www.w3.org/ns/sosa/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix dc: <http://purl.org/dc/elements/1.1/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix owl: <http://www.w3.org/2002/07/owl#>

select *
{
  ?s ?p sosa:Observation .
  ?s sosa:hasSimpleResult ?o .
  ?s sosa:resultTime ?o1 .
  BIND(xsd:float(STRBEFORE(?o, ' ')) as ?oFloat) .
} LIMIT 100

and got a query execution error. Querying directly the datasource I got a SPARQL error with the BIND keyword compilation. It will take me longer to fix it. This issue has nothing to do with LDH so I'm closing it. Thank you!

namedgraph commented 1 year ago

This comment suggest the BIND bug is fixed in Virtuoso 7.x https://stackoverflow.com/questions/26620480/sparql-bind-function-syntax-error#comment42655061_26622038