From: Ignazio P. <ipa...@gm...> - 2011-06-27 09:06:25
|
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 > > |