[Pellet-users] Problem getting hasValue restrictions within superclasses
Evren Sirin
evren at clarkparsia.com
Tue Feb 26 13:29:50 UTC 2008
Pellet will not return restrictions defined on superclasses. See this
FAQ entry:
http://pellet.owldl.com/faq/different-results/
The workaround would be to iterate through the superclasses and collect
all the asserted restrictions defined on each superclass.
Cheers,
Evren
On 2/26/08 2:41 AM, Horst Gutmann wrote:
> Hi everyone :-)
>
> I'm currently having a slightly strange problem. I want to get a list
> of all the value restrictions (in this case hasValue) for a given
> class in order to render to a UI. The problem is, that with this code,
> Pellet (used with Jena) only returns to me the restriction that is set
> on properties in the current class but seems to miss all the
> restrictions set in superclasses on different datatype properties:
>
> private static Map<OntProperty, Object> getHasValueRestrictions(OntClass c){
> Map<OntProperty, Object> result = new Hashtable<OntProperty, Object>();
> ArrayList<OntProperty> properties = new ArrayList<OntProperty>();
> Iterator<OntClass> scIt = c.listSuperClasses();
>
> Iterator<OntProperty> propIt = c.listDeclaredProperties();
> while(propIt.hasNext()){
> properties.add(propIt.next());
> }
>
> while(scIt.hasNext()){
> OntClass sc = scIt.next();
> if (!sc.isRestriction()) continue;
> if (!sc.asRestriction().isHasValueRestriction()) continue;
> Restriction rest = sc.asRestriction();
> for(OntProperty p : properties){
> if(rest.onProperty(p)){
> Object value = sc.asRestriction().asHasValueRestriction()
>
> .getHasValue().asNode().getLiteralValue();
> System.out.println(p.getLocalName()+" => "+value.toString());
> result.put(p, value);
> }
> }
> }
> return result;
> }
>
>
> Any idea what I'm doing wrong here? The same code works as far as I
> can tell with Jena's OWL_MEM_RULE_INF and OWL_MEM_TRANS_INF reasoners.
>
> Thanks :-)
> Horst
> _______________________________________________
> Pellet-users mailing list
> Pellet-users at lists.owldl.com
> http://lists.owldl.com/mailman/listinfo/pellet-users
> _______________________________________________
>
> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/
>
More information about the Pellet-users
mailing list