本文整理汇总了Java中org.semanticweb.owlapi.model.OWLObjectPropertyExpression.equals方法的典型用法代码示例。如果您正苦于以下问题:Java OWLObjectPropertyExpression.equals方法的具体用法?Java OWLObjectPropertyExpression.equals怎么用?Java OWLObjectPropertyExpression.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.semanticweb.owlapi.model.OWLObjectPropertyExpression
的用法示例。
在下文中一共展示了OWLObjectPropertyExpression.equals方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeFact
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
public Set<IRI> removeFact(ModelContainer model, OWLObjectPropertyExpression p,
OWLIndividual i, OWLIndividual j, METADATA metadata) {
OWLDataFactory f = model.getOWLDataFactory();
OWLOntology ont = model.getAboxOntology();
OWLAxiom toRemove = null;
Set<IRI> iriSet = new HashSet<IRI>();
Set<OWLObjectPropertyAssertionAxiom> candidates = ont.getObjectPropertyAssertionAxioms(i);
for (OWLObjectPropertyAssertionAxiom axiom : candidates) {
if (p.equals(axiom.getProperty()) && j.equals(axiom.getObject())) {
toRemove = axiom;
extractEvidenceIRIValues(axiom.getAnnotations(), iriSet);
break;
}
}
if (toRemove == null) {
// fall back solution
toRemove = f.getOWLObjectPropertyAssertionAxiom(p, i, j);
}
removeAxiom(model, toRemove, metadata);
return iriSet;
}
示例2: removeAnnotations
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
public OWLObjectPropertyAssertionAxiom removeAnnotations(ModelContainer model, OWLObjectPropertyExpression p,
OWLNamedIndividual i, OWLNamedIndividual j, Set<OWLAnnotation> annotations, METADATA metadata) {
OWLOntology ont = model.getAboxOntology();
Set<OWLObjectPropertyAssertionAxiom> axioms = ont.getObjectPropertyAssertionAxioms(i);
OWLObjectPropertyAssertionAxiom toModify = null;
for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
if (p.equals(axiom.getProperty()) && j.equals(axiom.getObject())) {
toModify = axiom;
break;
}
}
OWLObjectPropertyAssertionAxiom newAxiom = null;
if (toModify != null) {
Set<OWLAnnotation> combindedAnnotations = new HashSet<OWLAnnotation>(toModify.getAnnotations());
combindedAnnotations.removeAll(annotations);
newAxiom = modifyAnnotations(toModify, combindedAnnotations, model, metadata);
}
return newAxiom;
}
示例3: findEquivalentProperties
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
protected Map<OWLObjectPropertyExpression,Set<OWLObjectPropertyExpression>> findEquivalentProperties(Collection<OWLObjectPropertyExpression[]> simpleObjectPropertyInclusions) {
Graph<OWLObjectPropertyExpression> propertyDependencyGraph=new Graph<OWLObjectPropertyExpression>();
Map<OWLObjectPropertyExpression,Set<OWLObjectPropertyExpression>> equivalentObjectPropertiesMapping=new HashMap<OWLObjectPropertyExpression,Set<OWLObjectPropertyExpression>>();
for (OWLObjectPropertyExpression[] inclusion : simpleObjectPropertyInclusions)
if (!inclusion[0].equals(inclusion[1]) && !inclusion[0].equals(inclusion[1].getInverseProperty().getSimplified()))
propertyDependencyGraph.addEdge(inclusion[0],inclusion[1]);
propertyDependencyGraph.transitivelyClose();
for (OWLObjectPropertyExpression objExpr : propertyDependencyGraph.getElements()) {
if (propertyDependencyGraph.getSuccessors(objExpr).contains(objExpr) || propertyDependencyGraph.getSuccessors(objExpr).contains(objExpr.getInverseProperty().getSimplified())) {
Set<OWLObjectPropertyExpression> equivPropertiesSet=new HashSet<OWLObjectPropertyExpression>();
for (OWLObjectPropertyExpression succ : propertyDependencyGraph.getSuccessors(objExpr)) {
if (!succ.equals(objExpr) && (propertyDependencyGraph.getSuccessors(succ).contains(objExpr) || propertyDependencyGraph.getSuccessors(succ).contains(objExpr.getInverseProperty().getSimplified())))
equivPropertiesSet.add(succ);
}
equivalentObjectPropertiesMapping.put(objExpr,equivPropertiesSet);
}
}
return equivalentObjectPropertiesMapping;
}
示例4: increaseWithDefinedInverseIfNecessary
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
protected void increaseWithDefinedInverseIfNecessary(OWLObjectPropertyExpression propertyToBuildAutomatonFor,Automaton leafPropertyAutomaton,Map<OWLObjectPropertyExpression,Set<OWLObjectPropertyExpression>> inversePropertiesMap,Map<OWLObjectPropertyExpression,Automaton> individualAutomata) {
Set<OWLObjectPropertyExpression> inverses=inversePropertiesMap.get(propertyToBuildAutomatonFor);
if (inverses!=null) {
Automaton inversePropertyAutomaton=null;
for (OWLObjectPropertyExpression inverse : inverses) {
if (individualAutomata.containsKey(inverse) && !inverse.equals(propertyToBuildAutomatonFor)) {
inversePropertyAutomaton=individualAutomata.get(inverse);
increaseAutomatonWithInversePropertyAutomaton(leafPropertyAutomaton,inversePropertyAutomaton);
}
}
}
else if (individualAutomata.containsKey(propertyToBuildAutomatonFor.getInverseProperty().getSimplified())) {
Automaton autoOfInv_Role = individualAutomata.get(propertyToBuildAutomatonFor.getInverseProperty().getSimplified());
increaseAutomatonWithInversePropertyAutomaton(leafPropertyAutomaton,autoOfInv_Role);
}
}
示例5: addAnnotations
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
public void addAnnotations(ModelContainer model, OWLObjectPropertyExpression p,
OWLNamedIndividual i, OWLNamedIndividual j, Set<OWLAnnotation> annotations,
METADATA metadata) {
OWLOntology ont = model.getAboxOntology();
Set<OWLObjectPropertyAssertionAxiom> axioms = ont.getObjectPropertyAssertionAxioms(i);
OWLObjectPropertyAssertionAxiom toModify = null;
for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
if (p.equals(axiom.getProperty()) && j.equals(axiom.getObject())) {
toModify = axiom;
break;
}
}
addAnnotations(model, toModify, annotations, metadata);
}
示例6: updateAnnotation
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
public void updateAnnotation(ModelContainer model, OWLObjectPropertyExpression p,
OWLNamedIndividual i, OWLNamedIndividual j, OWLAnnotation update,
METADATA metadata) {
OWLOntology ont = model.getAboxOntology();
Set<OWLObjectPropertyAssertionAxiom> axioms = ont.getObjectPropertyAssertionAxioms(i);
OWLObjectPropertyAssertionAxiom toModify = null;
for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
if (p.equals(axiom.getProperty()) && j.equals(axiom.getObject())) {
toModify = axiom;
break;
}
}
updateAnnotation(model, toModify, update, metadata);
}
示例7: createAutomata
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
protected void createAutomata(Map<OWLObjectPropertyExpression,Automaton> automataByProperty,Set<OWLObjectPropertyExpression> complexObjectPropertyExpressions,Collection<OWLObjectPropertyExpression[]> simpleObjectPropertyInclusions,Collection<ComplexObjectPropertyInclusion> complexObjectPropertyInclusions) {
Map<OWLObjectPropertyExpression,Set<OWLObjectPropertyExpression>> equivalentPropertiesMap=findEquivalentProperties(simpleObjectPropertyInclusions);
Set<OWLObjectPropertyExpression> symmetricObjectProperties=findSymmetricProperties(simpleObjectPropertyInclusions);
Map<OWLObjectPropertyExpression,Set<OWLObjectPropertyExpression>> inversePropertiesMap=buildInversePropertiesMap(simpleObjectPropertyInclusions);
Graph<OWLObjectPropertyExpression> propertyDependencyGraph=buildPropertyOrdering(simpleObjectPropertyInclusions,complexObjectPropertyInclusions,equivalentPropertiesMap);
checkForRegularity(propertyDependencyGraph,equivalentPropertiesMap);
Graph<OWLObjectPropertyExpression> complexPropertiesDependencyGraph=propertyDependencyGraph.clone();
Set<OWLObjectPropertyExpression> transitiveProperties=new HashSet<OWLObjectPropertyExpression>();
Map<OWLObjectPropertyExpression,Automaton> individualAutomata=buildIndividualAutomata(complexPropertiesDependencyGraph,simpleObjectPropertyInclusions,complexObjectPropertyInclusions,equivalentPropertiesMap,transitiveProperties);
Set<OWLObjectPropertyExpression> simpleProperties=findSimpleProperties(complexPropertiesDependencyGraph,individualAutomata);
propertyDependencyGraph.removeElements(simpleProperties);
complexPropertiesDependencyGraph.removeElements(simpleProperties);
complexObjectPropertyExpressions.addAll(complexPropertiesDependencyGraph.getElements());
Set<OWLObjectPropertyExpression> inverseOfComplexProperties = new HashSet<OWLObjectPropertyExpression>();
for( OWLObjectPropertyExpression complexProp : complexObjectPropertyExpressions )
inverseOfComplexProperties.add( complexProp.getInverseProperty().getSimplified() );
complexObjectPropertyExpressions.addAll(inverseOfComplexProperties);
connectAllAutomata(automataByProperty,propertyDependencyGraph,inversePropertiesMap,individualAutomata,simpleObjectPropertyInclusions,symmetricObjectProperties,transitiveProperties);
Map<OWLObjectPropertyExpression,Automaton> individualAutomataForEquivRoles=new HashMap<OWLObjectPropertyExpression,Automaton>();
for (OWLObjectPropertyExpression propExprWithAutomaton : automataByProperty.keySet())
if (equivalentPropertiesMap.get(propExprWithAutomaton)!=null) {
Automaton autoOfPropExpr = automataByProperty.get(propExprWithAutomaton);
for (OWLObjectPropertyExpression equivProp : equivalentPropertiesMap.get(propExprWithAutomaton))
if (!equivProp.equals(propExprWithAutomaton) && !automataByProperty.containsKey(equivProp)) {
Automaton automatonOfEquivalent=(Automaton)autoOfPropExpr.clone();
individualAutomataForEquivRoles.put(equivProp, automatonOfEquivalent);
simpleProperties.remove(equivProp);
complexObjectPropertyExpressions.add(equivProp);
}
}
automataByProperty.putAll(individualAutomataForEquivRoles);
}
示例8: propertySubsumer
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
private OWLObjectPropertyExpression propertySubsumer(OWLObjectPropertyExpression p1, OWLObjectPropertyExpression p2) {
if (p1.equals(p2))
return p1;
// TODO - check for topObjectProp?
if (graph.getSuperPropertiesOf(p1).contains(p2)) {
return p2;
}
if (graph.getSuperPropertiesOf(p2).contains(p1)) {
return p1;
}
return null;
}
示例9: getOWLGraphEdgeSubsumers
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
public Set<OWLGraphEdge> getOWLGraphEdgeSubsumers(OWLGraphEdge e, int i) {
Set<OWLGraphEdge> subsumers = new OWLGraphEdgeSet();
if (i >= e.getQuantifiedPropertyList().size()) {
subsumers.add(new OWLGraphEdge(e.getSource(), e.getTarget(),
new Vector<OWLQuantifiedProperty>(), e.getOntology(), e.getAxioms(),
e.getGCIFiller(), e.getGCIRelation()));
return subsumers;
}
OWLQuantifiedProperty qp = e.getQuantifiedPropertyList().get(i);
Set<OWLQuantifiedProperty> superQps = new HashSet<OWLQuantifiedProperty>();
superQps.add(qp);
OWLObjectProperty p = qp.getProperty();
if (p != null) {
for (OWLObjectPropertyExpression pe : getSuperPropertyClosureOf(p)) {
if (pe.equals(this.getDataFactory().getOWLTopObjectProperty()))
continue;
if (pe instanceof OWLObjectProperty) {
OWLQuantifiedProperty newQp = new OWLQuantifiedProperty(pe, qp.getQuantifier());
if (!isExcluded(newQp)) {
superQps.add(newQp);
}
}
}
}
for (OWLQuantifiedProperty sqp : superQps) {
for (OWLGraphEdge se : getOWLGraphEdgeSubsumers(e, i+1)) {
List<OWLQuantifiedProperty> qpl = new Vector<OWLQuantifiedProperty>();
qpl.add(sqp);
qpl.addAll(se.getQuantifiedPropertyList());
subsumers.add(new OWLGraphEdge(e.getSource(),e.getTarget(),
qpl, e.getOntology(), e.getAxioms(),
e.getGCIFiller(), e.getGCIRelation()));
}
}
return subsumers;
}
示例10: getOWLGraphEdgeSubRelsReflexive
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
/**
* Similar to {@link getOWLGraphEdgeSubRels(OWLGraphEdge)},
* except the <code>OWLQuantifiedProperty</code>s of <code>edge</code> are analyzed
* starting from the index <code>propIndex</code>.
*
* @param edge A <code>OWLGraphEdge</code> for which sub-relations
* should be obtained, with properties analyzed from index
* <code>propIndex</code>
* @param propIndex An <code>int</code> representing the index of the
* <code>OWLQuantifiedProperty</code> of <code>edge</code>
* to start the analysis with.
* @return A <code>Set</code> of <code>OWLGraphEdge</code>s representing
* the sub-relations of <code>edge</code> ordered from the more general
* to the more precise relation, with <code>edge</code> as the first element,
* and with only <code>OWLQuantifiedProperty</code> starting at index
* <code>propIndex</code>. An empty <code>Set</code>
* if the <code>OWLQuantifiedProperty</code>s of <code>edge</code>
* have no sub-properties.
*/
private LinkedHashSet<OWLGraphEdge> getOWLGraphEdgeSubRelsReflexive(OWLGraphEdge edge,
int propIndex) {
//we do not use a mechanism such as provided by OWLGraphEdge.OWLGraphEdgeSet,
//first because we need a LinkedHashSet, not a HashSet, second because
//by definition, subRels will not be populated with potentially equal edges.
LinkedHashSet<OWLGraphEdge> subRels = new LinkedHashSet<OWLGraphEdge>();
if (propIndex >= edge.getQuantifiedPropertyList().size()) {
subRels.add(new OWLGraphEdge(edge.getSource(), edge.getTarget(),
new Vector<OWLQuantifiedProperty>(), edge.getOntology(),
edge.getAxioms(), edge.getGCIFiller(), edge.getGCIRelation()));
return subRels;
}
OWLQuantifiedProperty quantProp = edge.getQuantifiedPropertyList().get(propIndex);
LinkedHashSet<OWLQuantifiedProperty> subQuantProps =
new LinkedHashSet<OWLQuantifiedProperty>();
subQuantProps.add(quantProp);
OWLObjectProperty prop = quantProp.getProperty();
if (prop != null) {
for (OWLObjectPropertyExpression propExp : this.getSubPropertyClosureOf(prop)) {
if (propExp.equals(this.getDataFactory().
getOWLTopObjectProperty()))
continue;
if (propExp instanceof OWLObjectProperty) {
OWLQuantifiedProperty newQp =
new OWLQuantifiedProperty(propExp, quantProp.getQuantifier());
boolean isExcluded = isExcluded(newQp);
if (!isExcluded) {
subQuantProps.add(newQp);
}
}
}
}
for (OWLQuantifiedProperty subQuantProp : subQuantProps) {
for (OWLGraphEdge nextPropEdge : this.getOWLGraphEdgeSubRelsReflexive(edge,
propIndex+1)) {
List<OWLQuantifiedProperty> quantProps = new Vector<OWLQuantifiedProperty>();
quantProps.add(subQuantProp);
quantProps.addAll(nextPropEdge.getQuantifiedPropertyList());
subRels.add(new OWLGraphEdge(edge.getSource(),edge.getTarget(),
quantProps, edge.getOntology(), edge.getAxioms(),
edge.getGCIFiller(), edge.getGCIRelation()));
}
}
return subRels;
}