[Pellet-users] Help with "site->hasAddress->anyURI" example

John Berryman berryman at barron-associates.com
Tue May 12 17:27:01 UTC 2009


Hello All,

I intend to create an ontology in Jena/Pellet that contains an  
OntClass called Site and a Property called hasAddress which maps Sites  
to XSD:anyURI.  I then intend to create and individual called homepage  
that is mapped to some website address.

CODE:
 >>>>>>>>>>>>>>>>>>>>
OntModel model =  
ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, null);	
String namespace = "myNamespace";
		
OntClass Site = model.createClass(namespace + "#Site");
		
DatatypeProperty hasAddress = model.createDatatypeProperty(namespace +  
"#hasAddress");
hasAddress.addDomain(Site);
hasAddress.addRange(XSD.anyURI);
		
		
Individual homepage = Site.createIndividual(namespace + "#homepage");
		
homepage.addLiteral(hasAddress, "http://www.myhomepage.com");
 >>>>>>>>>>>>>>>>>>>>

This last line is what's killing me.  I only know how to insert the  
address as a string rather than a URI.  I've tried using the  
model.createTypedLiteral("http://www.myhomepage.com","xsd:anyURI");  
and various such concoctions, but to no avail.  Has anybody got any  
advice?  If this is the wrong forum for these questions, then can  
anyone point me in a better direction?

Thanks in advance,
John


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.owldl.com/pipermail/pellet-users/attachments/20090512/609afa63/attachment.htm 


More information about the Pellet-users mailing list