[Pellet-users] Koperator
Alejandro Sanchez
ale at iist.unu.edu
Wed Jan 16 12:15:37 UTC 2008
Problem solved, a typo in a namespace was the issue. The code below
restrics an individual's property.
Thank you.
> OWLObjectProperty hasSecondary =
> factory.getOWLObjectProperty(URI.create(...));
> OWLIndividual form794 = ...
> ...
> OWLObjectExactCardinalityRestriction restr =
> factory.getOWLObjectExactCardinalityRestriction(hasSecondary, 1);
> OWLClassAssertionAxiom restrictAxiom =
> factory.getOWLClassAssertionAxiom(form794, restr);
> manager.applyChange(new AddAxiom(ontology, restrictAxiom));
Alejandro Sanchez wrote:
> Sorry for this late response, but yes, we solved the problem. However
> the solution you attached is much neater. Many Thanks !
>
> Now I'm trying to dynamically generate the restrictions required for
> closing individual's properties from the attached ontology. For
> instance, given the following description:
>
> <owl:Class rdf:ID="ValidForm">
> <owl:equivalentClass>
> <owl:Class>
> <owl:intersectionOf rdf:parseType="Collection">
> <owl:Restriction>
> <owl:onProperty>
> <owl:ObjectProperty rdf:about="#hasSecondary" />
> </owl:onProperty>
> <owl:allValuesFrom>
> <owl:Class rdf:about="#SecondaryArticle"/>
> </owl:allValuesFrom>
> </owl:Restriction>
> <owl:Class rdf:about="#Form" />
> </owl:intersectionOf>
> </owl:Class>
> </owl:equivalentClass>
> </owl:Class>
>
> <Form rdf:ID="794">
> <hasMain rdf:resource="#AMobilePhone"/>
> <hasSecondary rdf:resource="#AHeadset"/>
> </Form>
>
> I would like to dynamically generate the description below, restricting
> (closing) an individual's property.
>
> <owl:Thing rdf:about="#794">
> <rdf:type>
> <owl:Restriction>
> <owl:cardinality
> rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">
> 1
> </owl:cardinality>
> <owl:onProperty>
> <owl:ObjectProperty rdf:about="#hasSecondary" />
> </owl:onProperty>
> </owl:Restriction>
> </rdf:type>
> </owl:Thing>
>
> With the API the closest I can do is ...
>
> OWLObjectProperty hasSecondary =
> factory.getOWLObjectProperty(URI.create(...));
> OWLIndividual form794 = ...
> ...
> OWLObjectExactCardinalityRestriction restr =
> factory.getOWLObjectExactCardinalityRestriction(hasSecondary, 1);
> OWLClassAssertionAxiom restrictAxiom =
> factory.getOWLClassAssertionAxiom(form794, restr);
> manager.applyChange(new AddAxiom(ontology, restrictAxiom));
>
> However, after executing this code, the reasoner does not find any
> ValidForm.
>
> What is the correct code for restricting an individual's property ?
>
> Many Thanks,
> Alejandro.
>
>
>
> Ibach, Brandon L wrote:
>> Alejandro,
>>
>> I'm not sure if your last message indicated that you had solved the
>> problem you were having, but when I tried running it through the Pellet
>> 1.5.1 command line, I got a number of errors. Most were syntax-related,
>> such as extra whitespace inside the cardinality restrictions, the use of
>> owl11:ObjectProperty instead of owl:ObjectProperty, the use of rdf:ID
>> instead of rdf:resource on some owl:inverseOf axioms and the syntax used
>> for enumerating the instances of owl:Thing. Pellet also complained
>> about the lack of typing information for the SWRL vocabulary, thus
>> making the ontology OWL Full, though I believe this is simply a
>> shortcoming of Pellet.
>>
>> All that said, I took the liberty of creating a modified version,
>> attached, which fixes these issues and simplifies the ontology a bit.
>>
>> I eliminated the need for declaring MainArticle to be equivalent to the
>> restriction on includedAsMain by simply changing the range of hasMain
>> (and, accordingly, the domain of includedAsMain) to MainArticle. This
>> also eliminates the need for the includedAsMain property, though I left
>> it in the ontology in case you want to use it for other purposes. I
>> also replaced the SWRL rule by making MainArticle a subclass of an
>> allValuesFrom restriction on hasAccessory, thereby making the object of
>> any hasAccessory triple on a MainArticle a ValidSecondaryArticle.
>>
>> Hopefully, this helps with your efforts. Feel free to ask if you have
>> any questions about the changes I made or if you run into any other
>> issues.
>>
>> -Brandon :)
More information about the Pellet-users
mailing list