It works. It would be nice of course if we could add to sesame some
code to do inferencing on this datatype.
Just a helpful pointer...
On Mar 8, 2:17 pm, Norman Heino <norman.he...@googlemail.com> wrote:
> Hello,
>
> I am using rdfQuery in a project where I need to create literals with user-defined datatypes, e.g. "123"^^<http://ns.aksw.org/types/myIntegerSubset>
>
> I tried creating such a literal using the following code:
>
> var l = $.rdf.literal('"123"^^akswt:myIntegerSubset', {namespaces: {'akswt': 'http://ns.aksw.org/types/'}});
>
> However, rdfQuery throws the following exception:
>
> InvalidDatatype: The datatypehttp://ns.aksw.org/types/myIntegerSubsetcan't be recognised
You can use user-defined datatypes, but you should define it as a type
like this:
$.typedValue.types['http://ns.aksw.org/types/myIntegerSubset'] = {
regex: /^[\-\+]?[0-9]+$/,
strip: true,
value: function (v) {
return parseInt(v, 10);
}
};
You can define a validate property for the type as well, if you want,
for example to test that all the values are between certain numbers.
Jeni
> --
> You received this message because you are subscribed to the Google
> Groups "rdfQuery" group.
> To post to this group, send email to rdfq...@googlegroups.com.
> To unsubscribe from this group, send email to rdfquery+u...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/rdfquery?hl=en
> .
--
Jeni Tennison
http://www.jenitennison.com
Norman