Hi,
On Sat, 2011-09-03 at 10:37 -0400, Phillip Rhodes wrote:
> On Sat, Sep 3, 2011 at 10:19 AM, Dave Reynolds
> <[email protected]> wrote:
> > Hi,
> >>
> >> (leaving out namespace declarations and such to save space)
> >>
> >> <rdf:Description rdf:about="&example;Milk">
> >> <rdf:type rdf:resource="&skos;Concept" />
> >> <skos:narrower rdf:resource="&example;MilkBySourceAnimal" />
> >> </rdf:Description>
> >
> > I don't think that is legal.
> >
> > I'm not an expert on SKOS:Collections but as far as I can see from the
> > spec [1] the range of skos:narrower is skos:Concept (S19, S21, S22) and
> > skos:Collection is disjoint from skos:Concept (S37). So you can't have a
> > Collection as a narrowing of a Concept.
> >
> > I don't think so. Even if your SKOS were not illegal there's nothing in
> > the spec [1] that I can see that connects skos:narrower with
> > skos:member.
> >
> > I don't have a copy of the book to hand, can you clarify exactly what it
> > is saying about inference over skos:member?
> >
>
> Hmmm... well, this book is a few years old, so it's possible that the spec has
> changed, or even that there is a mistake in the book. But here's what it
> says:
>
> "SKOS includes a special provision for implementing Collections of concepts."
> ...
> "This practice of grouping concepts is common practice in indexing and
> cataloguing.
> It is important to notice that according to the common practice of
> professional cataloguers,
> the grouping 'milk by source animal' is itself not a Concept in its
> own right; it is simply a grouping
> for Concepts. SKOS uses a class called skos:Collection and a property
> called SKOSmember
> to express such situations."
> ...
> "The interest in this example comes when we examine what inferences we can
> draw
> from such a construct. So far we have only used skos:narrower to
> express that one term has
> another as a narrower term. But what would it mean to this same
> notion of skos:narrower
> to describe the relationship between a term and a collection? "
> ...
> "If we have triples of the form:
>
> X skos:narrower C
> C skos:member Y
> then we can infer the triple
> X skos:narrower Y
>
> When we apply this rule to agro:Milk, we can infer that it has as a narrower
> term, each of the kinds of milk in the collection agro:MilkBySourceAnimal"
>
> And the RDF I originally posted is basically their example from the
> book, although I ditched
> their "agro" prefix and put everything under "example".
That all sounds plausible and is easy to implement but as I say, I don't
see that is compatible with the published spec. SKOS did change quite a
bit between its initial submission (out of the SWADE project) and the
final Rec so it's possible this is an area that changed.
> > Most of SKOS inference is inherited from OWL and so indeed combining
> > instance data, the SKOS axioms and an OWL reasoner should be enough for
> > most cases (though I recommend using OWLMicro as the default OWL
> > reasoner).
> > There are some special purpose inference rules in SKOS. Jena does not
> > have them built in but it would be fairly easy to express then in
> > JenaRules and use a GenericRuleReasoner.
>
> Ok, that's pretty much what I was thinking as well. I have yet to
> learn to use the
> GenericRuleReasoner and work with the low level rules stuff, but maybe it's
> time
> to dig in... just for my edification, even if I don't have a specific
> need for this
> right now.
A basic set up is very easy:
[[[
Model data = FileManager.get().loadModel("data/test.rdf");
List<Rule> rules = Rule.rulesFromURL("file:data/test.rules");
GenericRuleReasoner reasoner = new GenericRuleReasoner(rules);
InfModel inf = ModelFactory.createInfModel(reasoner, data);
inf.setNsPrefixes( data );
inf.write(System.out, "Turtle");
]]]
where data/test.rdf is your file with entities defined and
data/test.rules is:
[[[
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
(?X skos:narrower ?C) (?C skos:member ?Y) -> (?X skos:narrower ?Y) .
]]]
gives:
[[[
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix example: <http://openjena.org/eg#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
example:Milk
a skos:Concept ;
skos:narrower example:MilkBySourceAnimal , example:SheepMilk ,
example:BuffaloMilk , example:CowMilk , example:GoatMilk .
...
]]]
Dave