本文整理汇总了Java中org.semanticweb.owlapi.model.OWLOntology.getClassAssertionAxioms方法的典型用法代码示例。如果您正苦于以下问题:Java OWLOntology.getClassAssertionAxioms方法的具体用法?Java OWLOntology.getClassAssertionAxioms怎么用?Java OWLOntology.getClassAssertionAxioms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.semanticweb.owlapi.model.OWLOntology
的用法示例。
在下文中一共展示了OWLOntology.getClassAssertionAxioms方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTypes
import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public NodeSet<OWLClass> getTypes(OWLNamedIndividual ind, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
ensurePrepared();
DefaultNodeSet<OWLClass> result = new OWLClassNodeSet();
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLClassAssertionAxiom axiom : ontology.getClassAssertionAxioms(ind)) {
OWLClassExpression ce = axiom.getClassExpression();
if (!ce.isAnonymous()) {
result.addNode(classHierarchyInfo.getEquivalents(ce.asOWLClass()));
if (!direct) {
result.addAllNodes(getSuperClasses(ce, false).getNodes());
}
}
}
}
return result;
}
示例2: removeDangningAnnotations
import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
@CLIMethod("--remove-dangling-annotations")
public void removeDangningAnnotations(Opts opts) throws Exception {
OWLOntology ont = g.getSourceOntology();
int n = 0;
Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
for (OWLNamedIndividual i : ont.getIndividualsInSignature()) {
for (OWLClassAssertionAxiom ca : ont.getClassAssertionAxioms(i)) {
OWLClassExpression cx = ca.getClassExpression();
if (cx instanceof OWLClass) {
OWLClass c = (OWLClass) cx;
String label = g.getLabel(c);
if (label == null)
rmAxioms.add(ca);
else
n++;
}
}
}
LOG.info("Removing " + rmAxioms.size() + " axioms");
ont.getOWLOntologyManager().removeAxioms(ont, rmAxioms);
LOG.info("Remaining: " + n + " axioms");
}
示例3: getSvfTypes
import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
private Set<OWLObjectSomeValuesFrom> getSvfTypes(OWLNamedIndividual i, OWLOntology model) {
Set<OWLClassAssertionAxiom> axioms = model.getClassAssertionAxioms(i);
final Set<OWLObjectSomeValuesFrom> svfs = new HashSet<OWLObjectSomeValuesFrom>();
for (OWLClassAssertionAxiom axiom : axioms) {
axiom.getClassExpression().accept(new OWLClassExpressionVisitorAdapter(){
@Override
public void visit(OWLObjectSomeValuesFrom svf) {
svfs.add(svf);
}
});
}
return svfs;
}
示例4: getTypes
import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
private Set<OWLClass> getTypes(OWLNamedIndividual i, OWLOntology model) {
Set<OWLClassAssertionAxiom> axioms = model.getClassAssertionAxioms(i);
Set<OWLClass> types = new HashSet<OWLClass>();
for (OWLClassAssertionAxiom axiom : axioms) {
OWLClassExpression ce = axiom.getClassExpression();
if (ce instanceof OWLClass) {
OWLClass cls = ce.asOWLClass();
if (cls.isBuiltIn() == false) {
types.add(cls);
}
}
}
return types;
}
示例5: getInstances
import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public NodeSet<OWLNamedIndividual> getInstances(OWLClassExpression ce, boolean direct) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
ensurePrepared();
DefaultNodeSet<OWLNamedIndividual> result = new OWLNamedIndividualNodeSet();
if (!ce.isAnonymous()) {
OWLClass cls = ce.asOWLClass();
Set<OWLClass> clses = new HashSet<OWLClass>();
clses.add(cls);
if (!direct) {
clses.addAll(getSubClasses(cls, false).getFlattened());
}
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLClass curCls : clses) {
for (OWLClassAssertionAxiom axiom : ontology.getClassAssertionAxioms(curCls)) {
OWLIndividual individual = axiom.getIndividual();
if (!individual.isAnonymous()) {
if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
result.addNode(getSameIndividuals(individual.asOWLNamedIndividual()));
}
else {
result.addNode(new OWLNamedIndividualNode(individual.asOWLNamedIndividual()));
}
}
}
}
}
}
return result;
}
示例6: getConceptSchemes
import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public Set<OWLNamedIndividual> getConceptSchemes () {
Set<OWLNamedIndividual> inds = new HashSet<OWLNamedIndividual>(10);
for (OWLOntology onto : getOWLEditorKit().getModelManager().getOntologies()) {
Set<OWLClassAssertionAxiom> axioms = onto.getClassAssertionAxioms(getOWLEditorKit().getModelManager().getOWLDataFactory().getOWLClass(SKOSVocabulary.CONCEPTSCHEME.getIRI()));
for (OWLClassAssertionAxiom axiom : axioms) {
inds.add(axiom.getIndividual().asOWLNamedIndividual());
}
}
return inds;
}
示例7: getConceptSchemes
import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public static Set<OWLIndividual> getConceptSchemes (OWLEditorKit owlEditorKit) {
Set<OWLIndividual> inds = new HashSet<OWLIndividual>();
for (OWLOntology onto : owlEditorKit.getModelManager().getOntologies()) {
Set<OWLClassAssertionAxiom> axioms = onto.getClassAssertionAxioms(owlEditorKit.getModelManager().getOWLDataFactory().getOWLClass(SKOSVocabulary.CONCEPTSCHEME.getIRI()));
for (OWLClassAssertionAxiom clssAx : axioms) {
inds.add(clssAx.getIndividual());
}
}
return inds;
}
示例8: getTypes
import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public static Set<OWLClassExpression> getTypes(OWLNamedIndividual i, OWLOntology ont) {
Set<OWLClassExpression> types;
if (i != null && ont != null) {
types = new HashSet<>();
for (OWLClassAssertionAxiom axiom : ont.getClassAssertionAxioms(i)) {
types.add(axiom.getClassExpression());
}
}
else {
types = Collections.emptySet();
}
return types;
}