本文整理匯總了Java中org.semanticweb.owlapi.model.OWLOntology.getSignature方法的典型用法代碼示例。如果您正苦於以下問題:Java OWLOntology.getSignature方法的具體用法?Java OWLOntology.getSignature怎麽用?Java OWLOntology.getSignature使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.semanticweb.owlapi.model.OWLOntology
的用法示例。
在下文中一共展示了OWLOntology.getSignature方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getExternalReferencedEntities
import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
*
* returns set of entities that belong to a referenced ontology that are referenced in the source ontology.
*
* If the source ontology is not explicitly declared, then all entities that are referenced in the source
* ontology and declared in a reference ontology are returned.
*
* Example: if the source ontology is cl, and cl contains axioms that reference go:1, go:2, ...
* and go is in the set of referenced ontologies, then {go:1,go:2,...} will be in the returned set.
* It is irrelevant whether go:1, ... is declared in the source (e.g. MIREOTed)
*
* Note this only returns direct references. See
* {@link #getClosureOfExternalReferencedEntities()} for closure of references
*
* @return all objects referenced by source ontology
*/
public Set<OWLEntity> getExternalReferencedEntities() {
OWLOntology ont = graph.getSourceOntology();
Set<OWLEntity> objs = ont.getSignature(Imports.EXCLUDED);
Set<OWLEntity> refObjs = new HashSet<OWLEntity>();
LOG.info("testing "+objs.size()+" objs to see if they are contained in: "+getReferencedOntologies());
for (OWLEntity obj : objs) {
//LOG.info("considering: "+obj);
// a reference ontology may have entities from the source ontology MIREOTed in..
// allow a configuration with the URI prefix specified
if (isInExternalOntology(obj)) {
refObjs.add(obj);
}
}
LOG.info("#refObjs: "+refObjs.size());
return refObjs;
}
示例2: searchModels
import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
@Deprecated
public Set<IRI> searchModels(Collection<String> ids) throws IOException {
final Set<IRI> resultSet = new HashSet<>();
// create IRIs
Set<IRI> searchIRIs = new HashSet<IRI>();
for(String id : ids) {
searchIRIs.add(graph.getIRIByIdentifier(id));
}
if (!searchIRIs.isEmpty()) {
// search for IRI usage in models
final Set<IRI> allModelIds = getAvailableModelIds();
for (IRI modelId : allModelIds) {
final ModelContainer model = getModel(modelId);
final OWLOntology aboxOntology = model.getAboxOntology();
Set<OWLEntity> signature = aboxOntology.getSignature();
for (OWLEntity entity : signature) {
if (searchIRIs.contains(entity.getIRI())) {
resultSet.add(modelId);
break;
}
}
}
}
// return results
return resultSet;
}
示例3: findTermIRI
import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
public static IRI findTermIRI(OWLOntology ont, String name) {
IRI out = null;
IRI tempIRI = IRI.create(name);
for(OWLEntity c : ont.getSignature()) {
if(c.getIRI().equals(tempIRI)) {
out = c.getIRI();
break;
}
else if(getManchesterSyntax(c).equals(name)) {
out = c.getIRI();
break;
}
}
return out;
}
示例4: getOboGraphJSONString
import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
* Generate a OboGraphs JSON ontology blob for the local axioms for an object.
*
* This will include
*
* - all logical axioms about the object
* - all annotations for all entities in the signature
*
* In other words, direct parents plus labels and other metadata on all entities
*
* @param obj
* @return JSON string
* @throws JsonProcessingException
* @throws OWLOntologyCreationException
*/
public String getOboGraphJSONString(OWLObject obj) throws JsonProcessingException, OWLOntologyCreationException {
FromOwl fromOwl = new FromOwl();
OWLOntologyManager m = sourceOntology.getOWLOntologyManager();
if (obj instanceof OWLNamedObject) {
OWLNamedObject nobj = (OWLNamedObject)obj;
OWLOntology ont = m.createOntology(nobj.getIRI());
Set<OWLAxiom> axioms = new HashSet<>();
if (nobj instanceof OWLClass) {
axioms.addAll(sourceOntology.getAxioms((OWLClass)nobj, Imports.INCLUDED));
}
else if (nobj instanceof OWLObjectProperty) {
axioms.addAll(sourceOntology.getAxioms((OWLObjectProperty)nobj, Imports.INCLUDED));
}
m.addAxioms(ont, axioms);
axioms = new HashSet<>();
for (OWLEntity e : ont.getSignature()) {
axioms.addAll(sourceOntology.getAnnotationAssertionAxioms(e.getIRI()));
}
axioms.addAll(sourceOntology.getAnnotationAssertionAxioms(nobj.getIRI()));
m.addAxioms(ont, axioms);
GraphDocument gd = fromOwl.generateGraphDocument(ont);
return OgJsonGenerator.render(gd);
}
else {
return "{}";
}
}
示例5: removeExternalEntities
import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
* removes external entities:
* - anything marked with IAO_0000412 is removed
* - if isMain is true then anything that is also present in an external ontology is removed
*
* @param isMain
* @param ont
*/
public void removeExternalEntities(boolean isMain, OWLOntology ont) {
Set<OWLEntity> objs = ont.getSignature(Imports.EXCLUDED);
Set<OWLClass> rmClasses = new HashSet<OWLClass>();
Set<OWLObjectProperty> rmProperties = new HashSet<OWLObjectProperty>();
Set<OWLIndividual> rmIndividuals = new HashSet<OWLIndividual>();
LOG.info("removing external entities marked with IAO_0000412 from: "+ont);
if (isMain) {
LOG.info("testing " + objs.size()
+ " objs to see if they are contained in the follow referenced ontologies: "
+ getReferencedOntologies());
}
for (OWLEntity obj : objs) {
final boolean isMarked = isImportMarkedEntity(obj, ont);
if (obj instanceof OWLClass) {
if ((isMain && isInExternalOntology(obj)) || isMarked) {
rmClasses.add((OWLClass) obj);
}
}
else if (obj instanceof OWLObjectProperty && isMarked) {
rmProperties.add((OWLObjectProperty) obj);
}
else if (obj instanceof OWLIndividual && isMarked) {
rmIndividuals.add((OWLIndividual) obj);
}
}
Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
for (OWLClass c : rmClasses) {
rmAxioms.addAll(ont.getAnnotationAssertionAxioms(c.getIRI()));
rmAxioms.addAll(ont.getDeclarationAxioms(c));
rmAxioms.addAll(ont.getAxioms(c, Imports.EXCLUDED));
}
for (OWLObjectProperty p : rmProperties) {
rmAxioms.addAll(ont.getAnnotationAssertionAxioms(p.getIRI()));
rmAxioms.addAll(ont.getDeclarationAxioms(p));
rmAxioms.addAll(ont.getAxioms(p, Imports.EXCLUDED));
}
for (OWLIndividual i : rmIndividuals) {
rmAxioms.addAll(ont.getAxioms(i, Imports.EXCLUDED));
}
if (!rmAxioms.isEmpty()) {
LOG.info("Removing "+rmAxioms.size()+" external axioms for: "+ ont.getOntologyID());
ont.getOWLOntologyManager().removeAxioms(ont, rmAxioms);
}
}