Hello Rumi and Vanessa,
1.
If ?date is of type xsd:date or xsd:dateTime and of valid syntax then
bif:contains(?date, '"1945*"' ) will not found it, because it will be
parsed at load/create and stored as SQL DATE value.
So if data are all accurate and typed properly then the filter is
(?date >= xsd:date("1945-01-01") && ?date < xsd:date("1946-01-01"))
If data falls under Murphy's Law, then the free-text will be OK for tiny
examples but not for "big" cases because bif:contains(?date, '"1945*"')
would require that less than 200 words in the table begins with 1945.
Still, some data can be of accurate type and syntax so range comparison
should be used for them and results aggregated via UNION.
2.
If dates mention timezones then the application can chose the beginning
and the end of the year in some timezones other than the default.
3.
In any case, (str(?p) != rdfs:label) should be written either as
(str(?p) != str(rdfs:label)) or (?p != rdfs:label), the latter is
preferable, keeping in mind that predicates are always IRIs.
Best Regards,
Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com
On Mon, 2011-02-07 at 23:05 +0100, Rumi Tsekova wrote:
> Hi Vanessa,
>
> To find all dates starting with 1945, the query could be changed to:
>
> SELECT DISTINCT ?s ?date
> FROM <http://dbpedia.org>
> WHERE
> {
> ?s ?p ?date . FILTER( bif:contains(?date, '"1945*"' ) && ( str(?p) !=
> rdfs:label))
> }
> LIMIT 30
>
>
> You can also use date range. See example at
> http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtTipsAndTricksGuideDataRangeQueries
>
>
> Hope this helps,
>
> Best Regards,
> Rumi
>
>
>
>
> > Hi!
> >
> > Is there any way to search for numbers using bif:contains?
> >
> > regex takes too long:
> >
> > SELECT DISTINCT ?s ?date FROM <http://dbpedia.org> WHERE { ?s ?p ?date .
> > FILTER regex(?date, "^1945")}LIMIT 10
> >
> > but bif:contains doesn't seem to work:
> >
> > SELECT DISTINCT ?s ?date FROM <http://dbpedia.org> WHERE { ?s ?p ?
> > date .FILTER( bif:contains(?date, 1945 ) && ( str(?p) != rdfs:label
> > ))}LIMIT 30
> >
> > Thanks!!
> > Vanessa.
> >