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; > Sent: Friday, July 16, 2021 at 10:06 AM > From: "Andy Seaborne" <a...@apache.org> > To: users@jena.apache.org > Subject: Re: Does Jena use duck typing? > > Literals are always datatyped in RDF. No guessing. > > > > There syntax conveniences: > > "abc" is the same as writing "abc"^^xsd:string. > > The specs say to prefer writing output without ^^xsd:string. > > In Turtle and related syntaxes: > > 42 is an xsd:integer == "42"^^xsd:integer > > 42.99 is an xsd:decimal > > 42e0 is an xsd;double. > > "2021-07-16" is string. > "2021-07-16"^^xsd;date is a date. > > and language strings "abc"@en have datatype rdf:langString. > > On 16/07/2021 08:35, Laura Morales wrote: > > When I insert new triples into a Jena/Fuseki store, are *all* the quoted > > literals treated as strings by default unless I specify the type explicitly > > (eg. xsd:dateTime)? Or does Jena use duck typing to determine the best type > > fit for storing the value? > > What about numbers instead? Will Jena store 42 as an xsd:integer and 42.99 > > as xsd:double if I don't explicitly write the type? > > > > How can I specify a set of constraints in Fuseki for all the properties of > > my model? For example "this property is a double, with range [1.0 .. 2.0]" > > (the same way that I can specify constraints on Postgres for example)? > > Using ontology/schema/shapes. > > Andy >