From: Ignazio P. <ipa...@gm...> - 2011-06-28 06:38:13
|
2011/6/28 An C. Tran <tca...@gm...>: > Thank you so much for your kind help, Ignazio. > > I executed your code with both OWLAPI v3.2.3 and the one that is shipped > with Pellet 2.2.2 and both them worked well. So, the problem should be a > bug in Pellet that prevent returning the annotation of axioms? Do you > have any idea about this problem? I wouldn't call it a bug. I believe the axioms you're obtaining in the explanation are not the very same objects that are in the ontology but are created on demand for the explanation (some explanation techniques can break the axioms into parts to make the explanation laconic), so they would not carry the annotations of the original axiom. It might happen that the axiom being used in the explanation is the same as the original axiom in the ontology, in which case the annotations appear to be lost. > If we cannot fix that bug in Pellet, I > think we can get a solution with the help of OWLAPI. Do you think so? You can try one simple workaround: - iterate over all axioms in the ontology - for each axiom A, call the getAxiomWithoutAnnotations() and put that into B - this will give you the axiom with annotations removed - in a map, put B -> A Then, take the axioms from the explanation and check whether the map contains them as keys; those which are in the map correspond to annotated axioms, and you can get the annotations from the value corresponding to that key (axiom equals() method is supposed to take into account the annotations). HTH, I. > > Thank you. > An. > > > On 6/27/2011 9:06 PM, Ignazio Palmisano wrote: >> 2011/6/27 An C. Tran<tca...@gm...>: >>> Hi all, >>> >>> Someone can help me with this: >>> >>> In my example, given an "OWLAxiom eq" is an EquivalentClass, the following >>> segment of code: >>> System.out.println("\n***" + eq.getAxiomType() + ":"); >>> System.out.println("Annotation: " + eq.getAnnotations()); >>> System.out.println(renderer.render(eq)); >>> >> Hi, >> I tried your code (with some changes to remove calls to Pellet) with >> the latest OWL API and I get this output: >> >> Reading file file:///Users/ignazio/Downloads/abd.muse.massey.ac.nz.owl...Ontology >> loaded >> >> ***EquivalentClasses: >> Annotation: [Annotation(rdfs:label "DurationAbnormality_Showering"^^xsd:string)] >> DurationAbnormality EquivalentTo Showering and (activityHasDuration some >> (Duration and ((hasDurationValue some double[> 15]) or >> (hasDurationValue some double[< 5])))) and (activityHasStarttime some >> Winter) >> >> ***EquivalentClasses: >> Annotation: [Annotation(rdfs:label "DurationAbnormality_Toileting"^^xsd:string)] >> DurationAbnormality EquivalentTo Toileting and (activityHasDuration some >> (Duration and (hasDurationValue some double[> 15]))) >> >> ***EquivalentClasses: >> Annotation: [Annotation(rdfs:label "EquivalentWinter_Ann")] >> Winter EquivalentTo Timepoint and (hasMonthValue some double[>= 5]) >> and (hasMonthValue some double[<= 8]) >> >> >> for this code: >> >> public class Explanation_EquiClass_Lite { >> private static final String file = >> "file:///Users/ignazio/Downloads/abd.muse.massey.ac.nz.owl"; >> private static OWLObjectRenderer renderer = new >> ManchesterOWLSyntaxOWLObjectRendererImpl(); //new >> DLSyntaxObjectRenderer(); >> >> public static void main(String[] args) throws Exception { >> System.out.print("Reading file " + file + "..."); >> OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); >> OWLOntology ontology = manager.loadOntology(IRI.create(file)); >> OWLDataFactory factory = manager.getOWLDataFactory(); >> System.out.println("Ontology loaded"); >> OWLAnnotationProperty label = factory.getRDFSLabel(); >> for (OWLAxiom e : ontology.getAxioms()) { >> Set<OWLAnnotation> labels = e.getAnnotations(label); >> if (labels.size()> 0) { >> System.out.println("\n***" + e.getAxiomType() + ":"); >> System.out.println("Annotation: " + labels); >> System.out.println(renderer.render(e)); >> } >> } >> } >> } >> >> >> I assume you're using Pellet 2.2.2 and the OWL API which ships with >> it, which is from March 2010 IIRC. There might be bugs in that version >> of the OWL API, or Pellet might be returning the axioms stripped of >> the annotations. You can try Pellet with the latest release (3.2.3), >> if the bug is in the OWL API that should fix it. >> HTH, >> I. >> >>> produces the following result: >>> ***EquivalentClasses: >>> Annotation: [] >>> DurationAbnormality EquivalentTo Showering and ...... >>> >>> The annotation is always empty while I assigned annotation for this >>> EquivalentClass before. >>> However, it runs well for classes. >>> >>> I attached my ontology and java code for your checking. >>> >>> >>> Cheers, >>> An. >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> All of the data generated in your IT infrastructure is seriously valuable. >>> Why? It contains a definitive record of application performance, security >>> threats, fraudulent activity, and more. Splunk takes this data and makes >>> sense of it. IT sense. And common sense. >>> http://p.sf.net/sfu/splunk-d2d-c2 >>> _______________________________________________ >>> Owlapi-developer mailing list >>> Owl...@li... >>> https://lists.sourceforge.net/lists/listinfo/owlapi-developer >>> >>> >> ------------------------------------------------------------------------------ >> All of the data generated in your IT infrastructure is seriously valuable. >> Why? It contains a definitive record of application performance, security >> threats, fraudulent activity, and more. Splunk takes this data and makes >> sense of it. IT sense. And common sense. >> http://p.sf.net/sfu/splunk-d2d-c2 >> _______________________________________________ >> Owlapi-developer mailing list >> Owl...@li... >> https://lists.sourceforge.net/lists/listinfo/owlapi-developer > > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2d-c2 > _______________________________________________ > Owlapi-developer mailing list > Owl...@li... > https://lists.sourceforge.net/lists/listinfo/owlapi-developer > |