[Mulgara-general] dates in an RDF mulgara model...

Hernandez, Genaro (NIH/OD) [E] hernange at od.nih.gov
Thu Dec 4 18:33:07 UTC 2008


Hi. I'm hoping that anyone out there in the Mulgara community can help
me. My "Original Message" below was answered by Paul. But there are some
things I don't understand about his answer. I don't know what are
filters. But I have seen emails concerning this topic. I looked for
documentation but was unsuccessful. Can someone point me to online
documentation about filters so I can learn about them?

I also want to know if someone can point me to some documentation where
I can learn to perform queries on dates? For example, see the query
below. The query has a ":before" which I'm unfamiliar with.

I hope someone out there can respond to my email.

Thank you,
Genaro

-----Original Message-----
From: gearon at gmail.com [mailto:gearon at gmail.com] On Behalf Of Paul
Gearon
Sent: Wednesday, December 03, 2008 5:14 PM
To: Hernandez, Genaro (NIH/OD) [E]
Subject: Re: dates in an RDF mulgara model...

On Wed, Dec 3, 2008 at 3:50 PM, Hernandez, Genaro (NIH/OD) [E]
<hernange at od.nih.gov> wrote:
> Hi there. I have several triples that I want to load into a Mulgara
> model. Some of those triples have dates. For example:
>
> _:blankNode <...dateCreated> "1999-01-01" .
>
> These triple are all strings that I load into Mulgara. But I want the
> dates to be of type date and not of type string. I have no clue how to
> do this. Can someone help me?

The data you define here *is* a string. There is no way for Mulgara to
think that it is anything else. For instance, you might think that
strings of this form should automatically be detected to be a date,
but if that were the case then we'd have to check for all data types:
times, numbers, etc. That would lead to one of numerous conflicts that
could arise. Is "2:12" a time, or a chapter/verse in the bible? Is
1001-01-01 a serial number for a company, or the first of the year
1008 years ago? etc. etc.

The only way to load this stuff as a date is by changing the format.
You need to write a filter that will take the above line and change it
to:

_:blankNode <...dateCreated> "1999-01-01"^^xsd:date .

> Can I then issue queries that would, for
> example, return all of the blank nodes before a specific date?

Yes. For everything before 2000-01-01 then I think the query is:

prefix mulgara: <http://mulgara.org/mulgara#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
select $n
where {
    $n <...dateCreated> $d .
    GRAPH <sys:xsd> { $d mulgara:before "2000-01-01"^^xsd:date }
}

Regards,
Paul



More information about the Mulgara-general mailing list