jena-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benson Margulies <bimargul...@gmail.com>
Subject Re: I think I've got some pretty basic confusion with reading into models
Date Thu, 09 Dec 2010 16:51:49 GMT
Dave,

Thanks.

I think that I may have still failed to give you enough information to
reason about my level of confusion, so I have a few followup
questions.

1.  I think I'm confused about 'Things'. My ontology doesn't mention
Thing anywhere explicitly. I have owl:Class elements and
owl:DatatypeProperty elements. When I create an individual with the
OntModel, is it a thing _ex officio_?

2. When I set up my OntModel to create my individuals in the first
place, should I be, somehow, attaching the URI that corresponds to my
ontolology to it?

3. I was really _only_ expecting to see the rex: items and not the
ontology itself. This leads me to ask: If my goal is just to take one
of these documents and push it into Mulgara, doing no inference on the
way, should I just be using a plain model and checking my work by
looking at Resources instead of Individuals? I think that the answer
is 'yes' based on your email, but I wanted to check.

I am very grateful for your assistance in my process of bootstrapping
myself into this whole areas, where, as you can tell, I am starting
from a very empty graph.

--benson





On Thu, Dec 9, 2010 at 11:04 AM, Dave Reynolds
<dave.e.reynolds@gmail.com> wrote:
> Hi Benson,
>
> On Thu, 2010-12-09 at 09:11 -0500, Benson Margulies wrote:
>> Here's a little RDF snippet:
>>
>> <rdf:RDF
>>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>>     xmlns:rex="http://www.basistech.com/ontologies/2010/6/rex.owl#"
>>     xmlns:owl="http://www.w3.org/2002/07/owl#"
>>     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
>>     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
>>   <rex:Location rdf:about="uri:c6c54ebb-a232-48cd-80fa-e4adf9cc5001#3">
>>     <rex:hasOriginalText rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>>     >Pakistan</rex:hasOriginalText>
>>     <rex:hasNormalizedText
>> rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>>     >Pakistan</rex:hasNormalizedText>
>>     <rex:hasEntityDetectionSource
>> rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>>     >gazetteer:../../../bt_root/rlp/rlp/dicts/en-all-gazetteer-LE.bin</rex:hasEntityDetectionSource>
>>   </rex:Location>
>> </rdf:RDF>
>>
>> The following rather trivial test fails. I'm sure I'm just befuddled,
>> could some kind soul rescue me?
>>
>>         OntModel model = ModelFactory.createOntologyModel();
>>         model.read(rdfStream, "", "RDF/XML-ABBREV");
>>         ExtendedIterator<Individual> individuals = model.listIndividuals();
>>         int individualCount = 0;
>>         while (individuals.hasNext()) {
>>             individualCount++;
>>         }
>>         assertTrue("Should have more than two individuals, but got " +
>> individualCount, individualCount > 0);
>
> Actually that's a tricky area :)
>
> For OWL then we treat an individual as being anything of type
> owl:Thing.
>
> If you have an OWL-capable reasoner configured for the OntModel then the
> code can just query for that directly. If you don't then it looks for
> all resources whose declared type is itself an owl:Class (and not part
> of the OWL/RDFS "furniture").
>
> Since you don't have a declaration of rex:Location anywhere then nothing
> bites.
>
> Since your test comment suggest you are expecting at least 2 then I'm
> guessing you mean to count rex:Location as well so you are probably just
> after resources mentioned rather than Individuals in the OWL sense. In
> that case try:
>
>       OntModel model =
> ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
>        model.read("file:data/temp2.rdf", "", "RDF/XML-ABBREV");
>
>        ExtendedIterator<RDFNode> nodes =
> model.listObjects().andThen( model.listSubjects() );
>        int count = 0;
>        while ( nodes.hasNext() ) {
>            if (nodes.next().isResource()) count ++;
>        }
>
>
> Note the explicit OntModelSpec to turn off the default RDFS reasoner
> which would otherwise complicate things.
>
>
> Actually checking this out revealed a possible bug in this area. RDFS
> reasoning can infer that rex:Location is a rdfs:Class so if you set the
> OntModel profile to RDFS then uri:c6c54ebb-a232-48cd-80fa-e4adf9cc5001#3
> is treated as an individual. The trouble is that a lot of stuff in the
> background RDFS knowledge are also treated as Individuals (28 of them
> including things that are rdfs:Class/rdf:Property). While technically
> correct (because in RDFS all resources are Individuals) I would have
> expected the OntModel conventions to filter those out. Ian will log a
> JIRA case the check this out (assuming he can get access to JIRA).
>
> Dave
>
>
>

Mime
View raw message