Dear Hugh,
I hope you are doing great.

We had the chance to exchange last year during the benchmark of Virtuoso for 
Publications Office.
I joined ERA in September, and we are using Virtuoso as backend for a railway 
infrastructure in Europe [1].

We have some problematic issues/queries for the application consuming RDF data 
stored in Virtuoo

1- Wrong results for BIND depending on OPTIONAL/BIND order

We have the following query, where 2 different parameters are requested and we 
want to also check if they are NYA or NA, for both.

# SPARQL query generated by ERA Search App

SELECT DISTINCT
    ?e2e8d0ff44169432a9b6a49d415768b6aeb230e6e308eacd14c58203edec7c1e
    ?5611b111a3e8b6a75f9cf140ebfc88a2400da808384163a68f6ea2b27feae0a2
    ?7c9eedbe297dee33d5692bb017576d5f90128c5a57245968861342c5d938bc15
    ?068c016b70a3e345e79f2c917aa68e82e0a103ed4a2d3a377fc7e6d65298e659

FROM http://data.europa.eu/949/graph/rinf

WHERE {

    ?e2e8d0ff44169432a9b6a49d415768b6aeb230e6e308eacd14c58203edec7c1e a 
http://data.europa.eu/949/OperationalPoint.

    ?e2e8d0ff44169432a9b6a49d415768b6aeb230e6e308eacd14c58203edec7c1e 
http://data.europa.eu/949/uopid 
?bed82d131276294cde9b33e06fc5540daf5ce0a0ca03c6428b296bff9ff8e95b.

    
FILTER(lcase(str(?bed82d131276294cde9b33e06fc5540daf5ce0a0ca03c6428b296bff9ff8e95b))
 = lcase("DEYBBMO"))

    ?e2e8d0ff44169432a9b6a49d415768b6aeb230e6e308eacd14c58203edec7c1e 
http://data.europa.eu/949/track 
?5611b111a3e8b6a75f9cf140ebfc88a2400da808384163a68f6ea2b27feae0a2.



    # Query part to get results for demonstrationINF
    OPTIONAL {
        ?5611b111a3e8b6a75f9cf140ebfc88a2400da808384163a68f6ea2b27feae0a2 
http://data.europa.eu/949/demonstrationINF 
?7c9eedbe297dee33d5692bb017576d5f90128c5a57245968861342c5d938bc15_direct.
    }

    BIND(
        
COALESCE(?7c9eedbe297dee33d5692bb017576d5f90128c5a57245968861342c5d938bc15_direct,
            
IF(EXISTS{?5611b111a3e8b6a75f9cf140ebfc88a2400da808384163a68f6ea2b27feae0a2 
http://data.europa.eu/949/notYetAvailable 
http://data.europa.eu/949/demonstrationINF}, 
http://data.europa.eu/949/notYetAvailable, ?unbound),
            
IF(EXISTS{?5611b111a3e8b6a75f9cf140ebfc88a2400da808384163a68f6ea2b27feae0a2 
http://data.europa.eu/949/notApplicable 
http://data.europa.eu/949/demonstrationINF}, 
http://data.europa.eu/949/notApplicable, ?unbound),
            http://data.europa.eu/949/notData )
        AS ?7c9eedbe297dee33d5692bb017576d5f90128c5a57245968861342c5d938bc15).



    # Query part to get results for verificationINF

    OPTIONAL {
        ?5611b111a3e8b6a75f9cf140ebfc88a2400da808384163a68f6ea2b27feae0a2 
http://data.europa.eu/949/verificationINF 
?068c016b70a3e345e79f2c917aa68e82e0a103ed4a2d3a377fc7e6d65298e659_direct.
    }

    BIND(
        
COALESCE(?068c016b70a3e345e79f2c917aa68e82e0a103ed4a2d3a377fc7e6d65298e659_direct,
            
IF(EXISTS{?5611b111a3e8b6a75f9cf140ebfc88a2400da808384163a68f6ea2b27feae0a2 
http://data.europa.eu/949/notYetAvailable 
http://data.europa.eu/949/verificationINF}, 
http://data.europa.eu/949/notYetAvailable, ?unbound),
            
IF(EXISTS{?5611b111a3e8b6a75f9cf140ebfc88a2400da808384163a68f6ea2b27feae0a2 
http://data.europa.eu/949/notApplicable 
http://data.europa.eu/949/verificationINF}, 
http://data.europa.eu/949/notApplicable, ?unbound),
            http://data.europa.eu/949/notData )
        AS ?068c016b70a3e345e79f2c917aa68e82e0a103ed4a2d3a377fc7e6d65298e659).
}

LIMIT 10


For one of the parameters we get the expected results, for the other we are not 
getting anything (notData is just the last option of the COALESCE).

If we execute the query with only one of the parameters, the results are the 
expected, but not with both at the same time.

We can only get the expected results reordering the statements in the previous 
query, like this:



# SPARQL query generated by ERA Search App



SELECT DISTINCT

    ?e2e8d0ff44169432a9b6a49d415768b6aeb230e6e308eacd14c58203edec7c1e

    ?5611b111a3e8b6a75f9cf140ebfc88a2400da808384163a68f6ea2b27feae0a2

    ?7c9eedbe297dee33d5692bb017576d5f90128c5a57245968861342c5d938bc15

    ?068c016b70a3e345e79f2c917aa68e82e0a103ed4a2d3a377fc7e6d65298e659



FROM http://data.europa.eu/949/graph/rinf



WHERE {



    ?e2e8d0ff44169432a9b6a49d415768b6aeb230e6e308eacd14c58203edec7c1e a 
http://data.europa.eu/949/OperationalPoint.



    ?e2e8d0ff44169432a9b6a49d415768b6aeb230e6e308eacd14c58203edec7c1e 
http://data.europa.eu/949/uopid 
?bed82d131276294cde9b33e06fc5540daf5ce0a0ca03c6428b296bff9ff8e95b.



    
FILTER(lcase(str(?bed82d131276294cde9b33e06fc5540daf5ce0a0ca03c6428b296bff9ff8e95b))
 = lcase("DEYBBMO"))



OPTIONALs can be on top of BINDs or the other way around, both cases work, but 
not in between.

2- Error in COALESCE division by zero

The following query does not give the expected results.



SELECT ?test

WHERE {

    BIND (COALESCE(1/0,3) AS ?test)

}

Virtuoso 22012 Error SR084: Division by 0.


 *   Related: https://github.com/openlink/virtuoso-opensource/issues/309
 *   https://github.com/openlink/virtuoso-opensource/issues/140

Do you know if you can have a look on the above issues?
Thank you in advance,
Best regards,
Ghislain
[1] https://data-interop.era.europa.eu/endpoint


Ghislain ATEMEZING
Operational Data Unit
Project Officer


[cid:ERA-Left_7a09af29-d0d3-4fd4-afaa-996961d7f8a5.png]
        [cid:ERA-Right_5537eff3-85dc-40ff-b716-c4f1f445a7a6.png]



European Union Agency for Railways
120 rue Marc Lefrancq
BP 20392
FR-59307 Valenciennes Cedex
Visit our website: www.era.europa.eu<http://www.era.europa.eu>
E-mail: 
ghislain.atemez...@era.europa.eu<mailto:ghislain.atemez...@era.europa.eu>
Mobile: +33 0609242967
Tel: +33 327096 500
        [cid:QR440828e1-a813-4075-85ad-e9a07d558b46.png]


<https://www.youtube.com/watch?v=6S3xD6Oc_64><https://www.youtube.com/watch?v=6S3xD6Oc_64><https://www.sifer-expo.com/en-gb.html><https://www.era.europa.eu/content/european-rail-safety-days-2023>

<https://www.era.europa.eu/content/era-multimodal-conference-2023-hamburg-germany><https://www.era.europa.eu/content/join-us-era-multimodal-conference-2023-hamburg>
This message is intended for the use of the addressee only and may contain 
information that is privileged and/or confidential information. If you are not 
the intended recipient, you are informed that any dissemination or other use of 
this message is strictly prohibited. If you have received this message in 
error, please inform the European Union Agency for Railways immediately by 
returning it and then delete the material.

The European Union Agency for Railways endeavours to keep its network free of 
viruses; however you are strongly advised to check this e-mail and any 
attachments for viruses. The European Union Agency for Railways accepts no 
responsibility with regard to any computer virus transferred by way of this 
e-mail.
________________________________
Please consider the environment before deciding to print this email
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to