Asserting a typed literal?

5 views
Skip to first unread message

Tim Lebo

unread,
May 19, 2012, 2:27:02 PM5/19/12
to surfrdf
SuRF,

Is there a way to assert a datatyped literal in SuRF?

I'm currently using:

attr.dcterms_date.append(str(self.myDate).replace(' ','T'))

which produces:

dcterms:date "2012-05-19T18:21:45.482630";

but I'd like to get:

dcterms:date "2012-05-19T18:21:45.482630"^^xsd:dateTime;

Is that possible? I'm guessing that I'd just pass an rdflib-typed
literal in, but I'm not familiar enough with rdflib, either.

Thanks for your consideration.

Regards,
Tim Lebo

Tim rdf

unread,
May 19, 2012, 2:37:19 PM5/19/12
to surfrdf
From:

http://readthedocs.org/docs/rdflib/en/latest/rdf_terms.html

use:

self.myDate = datetime.datetime.utcnow()

and

attr.dcterms_date.append(self.myDate)

to get:

dcterms:date "2012-05-19T18:35:31.925751"^^xsd:dateTime;

-Tim
> --
> You received this message because you are subscribed to the Google Groups "surfrdf" group.
> To post to this group, send email to sur...@googlegroups.com.
> To unsubscribe from this group, send email to surfrdf+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/surfrdf?hl=en.
>
Reply all
Reply to author
Forward
0 new messages