On Thu, 2011-09-22 at 16:11 +0200, Dennis Patzer wrote: 
> Hello,
> 
> I'm having problems with adding a simple statement to an OWL-model. I 
> create the model by the following code:
> 
>          
> event.setEventOntModel(ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM));
> 
>          OntModel eventOntModel = event.getEventOntModel();
>          String namespace = getEventNamespace(eventType);
> 
>          Resource subject = eventOntModel.createResource(namespace + 
> eventType);
>          Property predicate = eventOntModel.createProperty(NS_RDF, "about");
> 
>          eventOntModel.add(subject, predicate, "Test");
> 
>          eventOntModel.write(System.out);
> 
> In the last line I get the following confusingt exception:
> 
> * WARN [pool-1-thread-1] (BaseXMLWriter.java:96) - The URI rdf:about 
> cannot be serialized in RDF/XML.*

[snip] 

> Could someone please tell me, what am I doing wrong????

rdf:about is not a property it is part of the RDF/XML syntax used to
convey the URI of the resource being described. It's illegal to use a
property of that name in RDF/XML - hence the warning.

Give the URI of the resource as the argument you pass to
model.createResource.

You may find OntModel.createIndividual useful.

Dave


Reply via email to