"25" is sometimes really a string so
"25"^^xsd:string
could be OK
If you have an weakly build dataset with sometimes the age expressed as a
string and sometimes as an integer, and you know that, you can try
something like
SELECT *
WHERE
{
?s :age ?age .
FILTER (xsd:integer(?age) < 30)
}
--
Jean-Claude Moissinac
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Garanti
sans virus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Le dim. 25 juil. 2021 à 15:35, Andy Seaborne <[email protected]> a écrit :
>
>
> On 25/07/2021 14:08, Laura Morales wrote:
> > What I mean is... (with an example):
> > As far as I understand, these are valid triples that I can load into
> Fuseki/Jena at the same time in the same graph
> >
> > :alice :age "25"^^xsd:string;
> > :bob :age "20"^^xsd:integer;
> >
> > If then I execute this query:
> >
> > SELECT *
> > WHERE
> > {
> > ?s :age ?age .
> > FILTER (?age < 30)
> > }
> >
> > should Jena raise an error (because there is a :age property with a
> value that is not integer), or should it simply ignore :alice entirely
> because the type of the property (string) doesn't match the type that I'm
> querying for?
>
> "25"^^xsd:string < 30
>
> is a type error.
>
> Type errors in a FILTER makes the filter false. (It does not become an
> overall query error.)
>
> Andy
>
> >
> >
> >
> >
> >> Sent: Monday, July 19, 2021 at 12:40 PM
> >> From: "Andy Seaborne" <[email protected]>
> >> To: [email protected]
> >> Subject: Re: Does Jena use duck typing?
> >>
> >> It store triples/quads.
> >> Think of it as a table of triples and table of quads
> >>
> >> Comparison is defined by XQuery/XPath Functions and Operators.
> >>
> >> But maybe I don't understand what's behind the question.
> >>
> >> On 19/07/2021 07:02, Laura Morales wrote:
> >>> How is Jena able to index and search/compare properties with different
> data types?
> >>> For example if I have this graph
> >>>
> >>> :alice :foobar "2021-07-16"^^xsd:date;
> >>> :alice :foobar "foobar"^^xsd:string;
> >>> :alice :foobar "42"^^xsd:integer;
> >>
> >> You can't compare "2021-07-16"^^xsd:date with an xsd:string or an
> >> xsd:integer.
> >>
> >> They have different value spaces.
> >>
> >> Andy
>