From: Matthew H. <mat...@cs...> - 2008-11-28 14:04:52
|
Hi Christian, You code basically checks to see if an entity is referenced in an imported ontology, which is what I think you want to do. Cheers, Matthew > I need some help. I want to know, how i can check, if an entity is > imported or not. For example, if i have an ontology o1, which > imports an > ontology o2, i would like to know if a given OWLEntity belongs to o2 > or > not. Is there an easy way to get this information? > > I need to do this, because i create a set of special objects for all > named entities of an ontology and all named entities of all imported > ontologies. Now i need to know for one of the objects if it belongs to > an imported ontology or not. > > for now i use the following code, is it right? I am iterating through > all imported ontologies and ask for every ontology, if the entity is > referenced in the given ontology. If true, i break and return true. > > /public boolean checkIfEntityExistsInImportedOntology( > OWLEntity entity, OWLOntology ontology, OWLOntologyManager > manager) { > > for (OWLOntology ontology1 : > manager.getImports(ontology)) { > > if (ontology1.containsEntityReference(entity)) { > return true; > } > } > > return false; > > } > > /Many thanks > > Christian > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Owlapi-developer mailing list > Owl...@li... > https://lists.sourceforge.net/lists/listinfo/owlapi-developer |