You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Atakan Kaya <ka...@gmail.com> on 2012/07/04 16:04:29 UTC
User Defined XSD Data types
Hi,
I would like to load some user defined XSD Data types to the TypeMapper.
I read here:
http://jena.sourceforge.net/how-to/typedLiterals.html
But, whenever I load those datatypes from a file on my computer (using
XSDDatatype.loadUserDefined method), their URI become something like this:
C:\Users\Asus\workspace\XSD2OWL\CDA\CDA.xsd#StreetName
Problem is that I want to change this datatype's URI to
http://www.hl7.org/v3#StreetNameDatatype
but I can't find how to do this using Jena.
Also, is there any other way to load User Defined Datatypes without
using XSDDatatype.loadUserDefined method? Because, it only looks for XSD
simple types and converts them to RDF Datatypes. However, I will convert
XSD global elements with simple type to a RDF Datatype too.
Apart from all of above, actually what I want to do is to create this
triple;
<Ts rdf:ID="EX4_Ts_1">
<hasValue *rdf:datatype="TsDatatype"*>20000407130000+0500</value>
</Ts>
Is there any other way to add *rdf:datatype="TsDatatype"* to this triple? I
was using
Model.addProperty(Proporty, p, String lexicalForm, RDFDatatype datatype)
method to do that.
Can you please help me ?
Thank you very much.
Atakan Kaya
Re: User Defined XSD Data types
Posted by Dave Reynolds <da...@gmail.com>.
On 04/07/12 15:04, Atakan Kaya wrote:
> Hi,
>
> I would like to load some user defined XSD Data types to the TypeMapper.
> I read here:
> http://jena.sourceforge.net/how-to/typedLiterals.html
>
> But, whenever I load those datatypes from a file on my computer (using
> XSDDatatype.loadUserDefined method), their URI become something like this:
> C:\Users\Asus\workspace\XSD2OWL\CDA\CDA.xsd#StreetName
>
> Problem is that I want to change this datatype's URI to
> http://www.hl7.org/v3#StreetNameDatatype
> but I can't find how to do this using Jena.
The four argument form of loadUserDefined allows you to specify the base
URI separate from the actual source data. That is supposed to work, at
least there's a test case that uses that which passes.
> Also, is there any other way to load User Defined Datatypes without
> using XSDDatatype.loadUserDefined method? Because, it only looks for XSD
> simple types and converts them to RDF Datatypes. However, I will convert
> XSD global elements with simple type to a RDF Datatype too.
No, there's no support for this, you would have to roll your own.
> Apart from all of above, actually what I want to do is to create this
> triple;
> <Ts rdf:ID="EX4_Ts_1">
> <hasValue *rdf:datatype="TsDatatype"*>20000407130000+0500</value>
> </Ts>
> Is there any other way to add *rdf:datatype="TsDatatype"* to this triple? I
> was using
> Model.addProperty(Proporty, p, String lexicalForm, RDFDatatype datatype)
> method to do that.
You can create typed literals using:
model.createTypedLiteral(value, typeURI)
and then use those in resource#appProperty calls. So you can use
arbitrary datatype URIs in your data without necessarily having an
RDFDatatype instance for it.
Internally that uses:
TypeMapper.getInstance().getSafeTypeByName(typeURI);
to manufacture a dummy datatype if needed.
Dave
[Sorry for the slow reply, been essentially off-grid for a week.]