diff --git a/lib/src/sparql/eval.rs b/lib/src/sparql/eval.rs index 6253ef71..00bbb57e 100644 --- a/lib/src/sparql/eval.rs +++ b/lib/src/sparql/eval.rs @@ -2559,6 +2559,63 @@ fn partial_cmp_literals( EncodedTerm::BigStringLiteral { value_id: b } => compare_str_ids(dataset, a, b), _ => None, }, + + EncodedTerm::SmallSmallLangStringLiteral { + value: a, + language: la, + } => match b { + EncodedTerm::SmallSmallLangStringLiteral { + value: b, + language: lb, + } if la == lb => a.partial_cmp(b), + EncodedTerm::BigSmallLangStringLiteral { + value_id: b, + language: lb, + } if la == lb => compare_str_str_id(dataset, a, b), + _ => None, + }, + EncodedTerm::SmallBigLangStringLiteral { + value: a, + language_id: la, + } => match b { + EncodedTerm::SmallBigLangStringLiteral { + value: b, + language_id: lb, + } if la == lb => a.partial_cmp(b), + EncodedTerm::BigBigLangStringLiteral { + value_id: b, + language_id: lb, + } if la == lb => compare_str_str_id(dataset, a, b), + _ => None, + }, + EncodedTerm::BigSmallLangStringLiteral { + value_id: a, + language: la, + } => match b { + EncodedTerm::SmallSmallLangStringLiteral { + value: b, + language: lb, + } if la == lb => compare_str_id_str(dataset, a, b), + EncodedTerm::BigSmallLangStringLiteral { + value_id: b, + language: lb, + } if la == lb => compare_str_ids(dataset, a, b), + _ => None, + }, + EncodedTerm::BigBigLangStringLiteral { + value_id: a, + language_id: la, + } => match b { + EncodedTerm::SmallBigLangStringLiteral { + value: b, + language_id: lb, + } if la == lb => compare_str_id_str(dataset, a, b), + EncodedTerm::BigBigLangStringLiteral { + value_id: b, + language_id: lb, + } if la == lb => compare_str_ids(dataset, a, b), + _ => None, + }, EncodedTerm::FloatLiteral(a) => match b { EncodedTerm::FloatLiteral(b) => a.partial_cmp(b), EncodedTerm::DoubleLiteral(b) => Double::from(*a).partial_cmp(b), diff --git a/testsuite/oxigraph-tests/sparql/cmp_langString.rq b/testsuite/oxigraph-tests/sparql/cmp_langString.rq new file mode 100644 index 00000000..8df66542 --- /dev/null +++ b/testsuite/oxigraph-tests/sparql/cmp_langString.rq @@ -0,0 +1,4 @@ +SELECT ?a ?b ?o WHERE { + VALUES (?a ?b) { ("a"@fr "b"@fr) ("a"@en "b"@fr) } + BIND(?a < ?b AS ?o) +} \ No newline at end of file diff --git a/testsuite/oxigraph-tests/sparql/cmp_langString.srx b/testsuite/oxigraph-tests/sparql/cmp_langString.srx new file mode 100644 index 00000000..270869b1 --- /dev/null +++ b/testsuite/oxigraph-tests/sparql/cmp_langString.srx @@ -0,0 +1,29 @@ + + + + + + + + + + + a + + + b + + + true + + + + + a + + + b + + + + \ No newline at end of file diff --git a/testsuite/oxigraph-tests/sparql/manifest.ttl b/testsuite/oxigraph-tests/sparql/manifest.ttl index 84fbe799..b68f6255 100644 --- a/testsuite/oxigraph-tests/sparql/manifest.ttl +++ b/testsuite/oxigraph-tests/sparql/manifest.ttl @@ -16,6 +16,7 @@ :values_in_filter_exists :values_in_filter_not_exists :subquery_in_filter_not_exists + :cmp_langString ) . :describe rdf:type mf:QueryEvaluationTest ; @@ -65,3 +66,8 @@ mf:name "VALUES inside of FILTER EXISTS" ; mf:action [ qt:query ] ; mf:result . + +:cmp_langString rdf:type mf:QueryEvaluationTest ; + mf:name "rdf:langString with the same language are comparable" ; + mf:action [ qt:query ] ; + mf:result .