jena-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Reynolds <dave.e.reyno...@gmail.com>
Subject Re: Creating and working with RDF where I have an ontology
Date Thu, 09 Dec 2010 16:16:46 GMT
On Thu, 2010-12-09 at 10:57 -0500, Benson Margulies wrote: 
> This is a better-explained variation on a question I sent our earlier today.
> 
> I built an ontology with Protege that defines some classes.
> 
> I pushed the ontology into Jena schemagen to get some symbolic names
> for my URIs.
> 
> I create an ontology model,
> 
>             model = ModelFactory.createOntologyModel();
> 
> Note the last of any base uri that names my ontology.
> 
> and then I make calls like:
> 
>             entityRef = model.createIndividual(entityUri, oclass);
>             entityRef.addLiteral(Rex.hasEntityDetectionSource, source);
>             entityRef.addLiteral(Rex.hasNormalizedText, normalizedText);
>             entityRef.addLiteral(Rex.hasOriginalText, rawText);
> 
> I write this out
> 
>     ops.getModel().write(baos, "RDF/XML-ABBREV");
> 
> Now I want to read it in and look at it. All variations on
> OntModel.read() that I've tried result in a model with no individuals.
> 
> I can think of a number of ways in which the above might be defective,
> but I suspect that the readers of this list will have a brief ROTFL
> moment and tell me what very basic thing I've misunderstood.

Hopefully my previous response helps at a bit.

If you added:

      oclass.addRDFType(OWL.Class);

that would presumably also give the OntModel enough clue to be helpful.

I'm wondering why this doesn't come up more often. 

My guess is that in most cases people are either working in OWL/DL
(where you have to import the ontology into the instance data to be
valid DL) or in OWL/Full (where Individual isn't really a meaningfully
distinct notion).

Dave



Mime
View raw message