openlink / virtuoso-opensource

Virtuoso is a high-performance and scalable Multi-Model RDBMS, Data Integration Middleware, Linked Data Deployment, and HTTP Application Server Platform
https://vos.openlinksw.com
Other
861 stars 210 forks source link

Select with Max on xsd:datetime results in "Tag 248 not defined" #489

Open misl opened 9 years ago

misl commented 9 years ago

Running the following query on a small set of testdata (approx 50 triples) results in "Tag 248 not defined"

PREFIX oa:   <http://www.w3.org/ns/oa#>  
PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX reva: <http://data.reva.nl/2013/07/reva#>
PREFIX rela: <http://www.digimelding.nl/2013/11/relaties#>
PREFIX gem:  <http://www.bprbzk.nl/BRP/informatiebank/tabel33#>

SELECT ?graph ?timestamp ?addressesCount ?mostRecentTimestamp
WHERE {
  GRAPH ?graph {
    ?graph rdf:type reva:RootAnnotatie ;
      oa:annotatedAt ?timestamp .

    {
      SELECT 
              ?graph 
              (count(?addressTimestamp) as ?addressesCount) 
              (max(?addressTimestamp) as ?mostRecentTimestamp)
      WHERE {
        ?adresAnnotatie rdf:type reva:AdresAnnotatie ;
          oa:hasTarget ?graph ;
          oa:annotatedAt ?addressTimestamp .
      }
      GROUP BY ?graph
    }
  }
}

This exact same query ran just fine on Apache Jena TDB with Fuseki.

misl commented 9 years ago

The following is simple test data for the previous query. This RDFXML needs to be loaded into a graph named "urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd".

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:j.0="http://xmlns.com/foaf/0.1/"
    xmlns:j.1="http://data.reva.nl/2013/07/reva#"
    xmlns:j.2="http://www.w3.org/ns/prov#"
    xmlns:j.3="http://www.w3.org/ns/oa#" > 
  <rdf:Description rdf:about="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd#softwareAgent">
    <j.0:name>Reva</j.0:name>
    <rdf:type rdf:resource="http://www.w3.org/ns/prov#SoftwareAgent"/>
  </rdf:Description>
  <rdf:Description rdf:about="urn:uuid:131fc436-c262-496c-bbfc-37a16a8bae11#softwareAgent">
    <j.0:name>Reva</j.0:name>
    <rdf:type rdf:resource="http://www.w3.org/ns/prov#SoftwareAgent"/>
  </rdf:Description>
  <rdf:Description rdf:about="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd#agent">
    <rdf:type rdf:resource="http://www.w3.org/ns/prov#Agent"/>
    <j.0:nick>all</j.0:nick>
    <j.0:organisation>0003</j.0:organisation>
  </rdf:Description>
  <rdf:Description rdf:about="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd">
    <j.3:annotatedAt rdf:datatype="http://www.w3.org/2001/XMLSchema#xsd:dateTime">2015-10-06T11:51:31+02:00</j.3:annotatedAt>
    <j.3:annotatedBy rdf:resource="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd#agent"/>
    <rdf:type rdf:resource="http://data.reva.nl/2013/07/reva#RootAnnotatie"/>
    <j.3:serializedBy rdf:resource="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd#softwareAgent"/>
  </rdf:Description>
  <rdf:Description rdf:about="urn:uuid:2853a43f-b3d0-496c-9b98-72cd913b42bc">
    <rdf:type rdf:resource="http://data.reva.nl/2013/07/reva#AdresAnnotatie"/>
    <j.3:serializedBy rdf:resource="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd#softwareAgent"/>
    <j.3:annotatedBy rdf:resource="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd#agent"/>
    <j.3:hasTarget rdf:resource="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd"/>
    <j.3:hasBody rdf:resource="urn:uuid:2853a43f-b3d0-496c-9b98-72cd913b42bc#body"/>
    <j.3:annotatedAt rdf:datatype="http://www.w3.org/2001/XMLSchema#xsd:dateTime">2015-10-06T11:51:31+02:00</j.3:annotatedAt>
  </rdf:Description>
  <rdf:Description rdf:about="urn:uuid:66274fd1-d449-4a5c-893c-725795f61316">
    <j.3:annotatedBy rdf:resource="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd#agent"/>
    <rdf:type rdf:resource="http://data.reva.nl/2013/07/reva#DossierNummerAnnotatie"/>
    <j.3:serializedBy rdf:resource="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd#softwareAgent"/>
    <j.3:annotatedAt rdf:datatype="http://www.w3.org/2001/XMLSchema#xsd:dateTime">2015-10-06T11:51:31+02:00</j.3:annotatedAt>
    <j.3:hasBody>193471029470</j.3:hasBody>
    <j.3:hasTarget rdf:resource="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd"/>
  </rdf:Description>
  <rdf:Description rdf:about="urn:uuid:2853a43f-b3d0-496c-9b98-72cd913b42bc#body">
    <j.1:bagIdCodeNummerAanduiding>0363200000182507</j.1:bagIdCodeNummerAanduiding>
    <j.1:openbareruimte>Leidsestraat</j.1:openbareruimte>
    <j.1:bagIdCodePlaats>1024</j.1:bagIdCodePlaats>
    <j.1:huisnummer>4</j.1:huisnummer>
    <j.1:postcode>1017PA</j.1:postcode>
    <rdf:type rdf:resource="http://data.reva.nl/2013/07/reva#AdresBody"/>
    <j.1:bagGebruiksdoelen>woonfunctie, winkelfunctie</j.1:bagGebruiksdoelen>
    <j.1:adresType>Eigen adres</j.1:adresType>
    <j.1:woonplaats>Amsterdam</j.1:woonplaats>
  </rdf:Description>
  <rdf:Description rdf:about="urn:uuid:131fc436-c262-496c-bbfc-37a16a8bae11#agent">
    <j.0:organisation>0003</j.0:organisation>
    <j.0:nick>all</j.0:nick>
    <rdf:type rdf:resource="http://www.w3.org/ns/prov#Agent"/>
  </rdf:Description>
  <rdf:Description rdf:about="urn:uuid:131fc436-c262-496c-bbfc-37a16a8bae11">
    <rdf:type rdf:resource="http://data.reva.nl/2013/07/reva#AdresAnnotatie"/>
    <j.3:annotatedAt rdf:datatype="http://www.w3.org/2001/XMLSchema#xsd:dateTime">2015-10-06T11:52:30+02:00</j.3:annotatedAt>
    <j.3:annotatedBy rdf:resource="urn:uuid:131fc436-c262-496c-bbfc-37a16a8bae11#agent"/>
    <j.3:hasBody rdf:resource="urn:uuid:131fc436-c262-496c-bbfc-37a16a8bae11#body"/>
    <j.3:hasTarget rdf:resource="urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd"/>
    <j.3:serializedBy rdf:resource="urn:uuid:131fc436-c262-496c-bbfc-37a16a8bae11#softwareAgent"/>
  </rdf:Description>
  <rdf:Description rdf:about="urn:uuid:131fc436-c262-496c-bbfc-37a16a8bae11#body">
    <j.1:woonplaats>Amsterdam</j.1:woonplaats>
    <j.1:adresType>Eigen adres</j.1:adresType>
    <j.1:bagGebruiksdoelen>woonfunctie, winkelfunctie</j.1:bagGebruiksdoelen>
    <j.1:openbareruimte>Leidseplein</j.1:openbareruimte>
    <j.1:bagIdCodePlaats>1024</j.1:bagIdCodePlaats>
    <j.1:bagIdCodeNummerAanduiding>0363200000182507</j.1:bagIdCodeNummerAanduiding>
    <rdf:type rdf:resource="http://data.reva.nl/2013/07/reva#AdresBody"/>
    <j.1:huisnummer>4</j.1:huisnummer>
    <j.1:postcode>1017PA</j.1:postcode>
  </rdf:Description>
</rdf:RDF>

The response should be:

          graph: urn:uuid:8867cf60-807e-4cd8-ba0c-77874436c1dd
          timestamp: 2015-10-06T11:51:31+02:00
          addressesCount: 2
          mostRecentTimestamp: 2015-10-06T11:52:30+02:00 
HughWilliams commented 9 years ago

This is a know issue, see https://github.com/openlink/virtuoso-opensource/issues/338 we are scheduling to look into and provide a solution ...