本文整理汇总了Java中org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet类的典型用法代码示例。如果您正苦于以下问题:Java OWLClassNodeSet类的具体用法?Java OWLClassNodeSet怎么用?Java OWLClassNodeSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OWLClassNodeSet类属于org.semanticweb.owlapi.reasoner.impl包,在下文中一共展示了OWLClassNodeSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractMeaningfulRoots
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
/**
* @deprecated
*/
private Set<Integer> extractMeaningfulRoots(NodeSet<OWLClass> nodes, int level){
Set<Integer> mroots=new HashSet<Integer>();
OWLClassNodeSet mrootsClass = new OWLClassNodeSet();
for (Node<OWLClass> node : nodes.getNodes()){
for (Node<OWLClass> topNode : reasoner.getSubClasses(node.getRepresentativeElement(), true)){
mrootsClass.addNode(topNode);
if (class2identifier.containsKey(topNode.getRepresentativeElement())){
mroots.add(class2identifier.get(topNode.getRepresentativeElement()));
}
}
}
if (mroots.size()>=minNumberOfRoots || level==3){ //we want to avoid infinite recursion
return mroots;
}
else {
return extractMeaningfulRoots(mrootsClass, level+1);
}
}
示例2: getDisjointClasses
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
/**
* It was an error in original method. the result set contained both the given class and its equivalents.
*/
public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce) {
//super.ensurePrepared();
OWLClassNodeSet nodeSet = new OWLClassNodeSet();
if (!ce.isAnonymous()) {
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(ce.asOWLClass())) {
for (OWLClassExpression op : ax.getClassExpressions()) {
if (!op.isAnonymous() && !op.equals(ce)) { //Op must be differnt to ce
nodeSet.addNode(getEquivalentClasses(op));
}
}
}
}
}
return nodeSet;
}
示例3: getExplicitOWLDisjointnessAxioms
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
/**
* OWLDisjointAxiom(A,B,C)
* @param reasoner
* @param ontology
* @param cls
* @return
*/
public static OWLClassNodeSet getExplicitOWLDisjointnessAxioms(OWLReasoner reasoner, OWLOntology ontology, OWLClass cls){
OWLClassNodeSet nodeSet = new OWLClassNodeSet();
for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(cls)) {
for (OWLClassExpression op : ax.getClassExpressions()) {
if (!op.isAnonymous() && !op.equals(cls)) { //Op must be differnt to ce
nodeSet.addNode(reasoner.getEquivalentClasses(op));
}
}
}
return nodeSet;
}
示例4: getExplicitDLDisjointnessAxioms
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
/**
* A ^ B -> bottom
* @param reasoner
* @param ontology
* @param cls
* @author Shuo Zhang
* @return
*/
public static OWLClassNodeSet getExplicitDLDisjointnessAxioms(OWLReasoner reasoner, OWLOntology ontology, OWLClass cls){
OWLClassNodeSet nodeSet = new OWLClassNodeSet();
OWLClassExpression subExp;
Set<OWLClassExpression> set;
for (OWLSubClassOfAxiom sax : ontology.getSubClassAxiomsForSuperClass(OWLManager.getOWLDataFactory().getOWLNothing())) {
subExp = sax.getSubClass();
if (subExp instanceof OWLObjectIntersectionOf) {
set = subExp.asConjunctSet();
if (set.contains(cls) && set.size() == 2) {
for (OWLClassExpression op : set) {
if (!op.equals(cls) && !op.isAnonymous()) {
nodeSet.addNode(reasoner.getEquivalentClasses(op));
break;
}
}
}
}
}
return nodeSet;
}
示例5: getDisjointClasses
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce) {
ensurePrepared();
OWLClassNodeSet nodeSet = new OWLClassNodeSet();
if (!ce.isAnonymous()) {
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(ce.asOWLClass())) {
for (OWLClassExpression op : ax.getClassExpressions()) {
if (!op.isAnonymous()) {
nodeSet.addNode(getEquivalentClasses(op));
}
}
}
}
}
return nodeSet;
}
示例6: getTypes
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的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;
}
示例7: getSubClasses
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
public NodeSet<OWLClass> getSubClasses(OWLClassExpression ce, boolean direct)
throws ReasonerInterruptedException, TimeOutException,
FreshEntitiesException, InconsistentOntologyException,
ClassExpressionNotInProfileException {
DefaultNodeSet<OWLClass> result = new OWLClassNodeSet();
Set<OWLObject> subs = gw.queryDescendants(ce, false, true);
for (OWLObject s : subs) {
if (s instanceof OWLClassExpression) {
if (s instanceof OWLClass) {
result.addEntity((OWLClass) s);
}
else {
}
}
else {
}
}
return result;
}
示例8: getSuperClasses
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
public NodeSet<OWLClass> getSuperClasses(OWLClassExpression ce,
boolean direct) throws InconsistentOntologyException,
ClassExpressionNotInProfileException, FreshEntitiesException,
ReasonerInterruptedException, TimeOutException {
DefaultNodeSet<OWLClass> result = new OWLClassNodeSet();
Set<OWLObject> supers = gw.getSubsumersFromClosure(ce);
for (OWLObject sup : supers) {
if (sup instanceof OWLClassExpression) {
if (sup instanceof OWLClass) {
result.addEntity((OWLClass) sup);
}
else {
}
}
else {
}
}
return result;
}
示例9: getDisjointClasses
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
/**
* Getting all disjoint classes is costly. We get only explicit disjointness.
* We will complete with questions (A intersection B) later if necessary
*/
public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce) {
OWLClassNodeSet nodeSet = new OWLClassNodeSet();
if (!ce.isAnonymous()) {
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
}
}
return nodeSet;
/*if (!ce.isAnonymous()) {
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(ce.asOWLClass())) {
for (OWLClassExpression op : ax.getClassExpressions()) {
if (!op.isAnonymous() && !op.equals(ce)) { //Op must be differnt to ce
nodeSet.addNode(getEquivalentClasses(op));
}
}
}
}
} */
}
示例10: getSubClasses
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
public NodeSet<OWLClass> getSubClasses(OWLClassExpression ce, boolean direct) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
OWLClassNodeSet ns = new OWLClassNodeSet();
try{
//System.out.println("Class ok: " + ce.toString());
return super.getSubClasses(ce, direct);
}
catch (StackOverflowError e){
//to catch StackOverflowError error
System.err.println("StackOverflowError in Structural reasoner: getSubClasses for Class " + ce.toString());
return ns;
}
}
示例11: getSuperClasses
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
public NodeSet<OWLClass> getSuperClasses(OWLClassExpression ce, boolean direct) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
OWLClassNodeSet ns = new OWLClassNodeSet();
try{
return super.getSuperClasses(ce, direct);
}
catch (StackOverflowError e){
//to catch StackOverflowError error
System.err.println("StackOverflowError in Structural reasoner: getSuperClasses for Class " + ce.toString());
return ns;
}
}
示例12: getDisjointClasses
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
/**
* Getting all disjoint classes is costly. We get only explicit disjointness.
* We will complete with questions (A intersection B) later if necessary
*/
public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce) {
OWLClassNodeSet nodeSet = new OWLClassNodeSet();
if (!ce.isAnonymous()) {
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
nodeSet.addAllNodes(DisjointnessAxiomExtractor.getExplicitOWLDisjointnessAxioms(this, ontology, ce.asOWLClass()).getNodes());
}
}
return nodeSet;
/*if (!ce.isAnonymous()) {
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(ce.asOWLClass())) {
for (OWLClassExpression op : ax.getClassExpressions()) {
if (!op.isAnonymous() && !op.equals(ce)) { //Op must be differnt to ce
nodeSet.addNode(getEquivalentClasses(op));
}
}
}
}
}*/
}
示例13: getSubClasses
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
public NodeSet<OWLClass> getSubClasses(OWLClassExpression ce, boolean direct) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
OWLClassNodeSet ns = new OWLClassNodeSet();
if (!ce.isAnonymous()) {
ensurePrepared();
return classHierarchyInfo.getNodeHierarchyChildren(ce.asOWLClass(), direct, ns);
}
return ns;
}
示例14: getSuperClasses
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
public NodeSet<OWLClass> getSuperClasses(OWLClassExpression ce, boolean direct) throws InconsistentOntologyException, ClassExpressionNotInProfileException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
OWLClassNodeSet ns = new OWLClassNodeSet();
if (!ce.isAnonymous()) {
ensurePrepared();
return classHierarchyInfo.getNodeHierarchyParents(ce.asOWLClass(), direct, ns);
}
return ns;
}
示例15: getDataPropertyDomains
import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet; //导入依赖的package包/类
public NodeSet<OWLClass> getDataPropertyDomains(OWLDataProperty pe, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
ensurePrepared();
DefaultNodeSet<OWLClass> result = new OWLClassNodeSet();
for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
for (OWLDataPropertyDomainAxiom axiom : ontology.getDataPropertyDomainAxioms(pe)) {
result.addNode(getEquivalentClasses(axiom.getDomain()));
if (!direct) {
result.addAllNodes(getSuperClasses(axiom.getDomain(), false).getNodes());
}
}
}
return result;
}