本文整理汇总了Java中org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom.getFiller方法的典型用法代码示例。如果您正苦于以下问题:Java OWLObjectSomeValuesFrom.getFiller方法的具体用法?Java OWLObjectSomeValuesFrom.getFiller怎么用?Java OWLObjectSomeValuesFrom.getFiller使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom
的用法示例。
在下文中一共展示了OWLObjectSomeValuesFrom.getFiller方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
public void visit(OWLObjectSomeValuesFrom object) {
OWLClassExpression filler=object.getFiller();
if (filler instanceof OWLObjectOneOf) {
for (OWLIndividual individual : ((OWLObjectOneOf)filler).getIndividuals()) {
Variable z=nextZ();
m_bodyAtoms.add(Atom.create(getConceptForNominal(individual),z));
m_headAtoms.add(getRoleAtom(object.getProperty(),X,z));
}
}
else {
LiteralConcept toConcept=getLiteralConcept(filler);
Role onRole=getRole(object.getProperty());
AtLeastConcept atLeastConcept=AtLeastConcept.create(1,onRole,toConcept);
if (!atLeastConcept.isAlwaysFalse())
m_headAtoms.add(Atom.create(atLeastConcept,X));
}
}
示例2: filterSVFs
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
private static Set<OWLObjectSomeValuesFrom> filterSVFs(final OWLClassFilter clsFilter, Set<OWLObjectSomeValuesFrom> svfs) {
Predicate<OWLObjectSomeValuesFrom> predicate = new Predicate<OWLObjectSomeValuesFrom>() {
@Override
public boolean apply(OWLObjectSomeValuesFrom input) {
OWLClassExpression filler = input.getFiller();
Boolean result = filler.accept(new OWLClassExpressionVisitorExAdapter<Boolean>(Boolean.FALSE){
@Override
public Boolean visit(OWLClass cls) {
return clsFilter.use(cls);
}
});
if (result != null) {
return result.booleanValue();
}
return false;
}
};
svfs = Sets.filter(svfs, predicate);
return svfs;
}
示例3: handleIntersection
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
private void handleIntersection(List<CheckWarning> warnings, Set<OWLOntology> allOntologies,
OWLEquivalentClassesAxiom axiom, OWLObjectIntersectionOf intersection, OWLPrettyPrinter pp)
{
for(OWLClassExpression operand : intersection.getOperandsAsList()) {
OWLClass operandCls = null;
if (!operand.isAnonymous()) {
operandCls = operand.asOWLClass();
}
else if (operand instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom ristriction = (OWLObjectSomeValuesFrom) operand;
OWLClassExpression filler = ristriction.getFiller();
if (!filler.isAnonymous()) {
operandCls = filler.asOWLClass();
}
}
else {
// not translatable to OBO
handleGeneric(warnings, allOntologies, axiom, operand, pp);
}
if (operandCls != null && isDangling(operandCls, allOntologies)) {
final IRI iri = operandCls.getIRI();
String message = "Dangling reference "+iri+" in INTERSECTION_OF axiom: "+pp.render(axiom);
warnings.add(new CheckWarning(getID(), message , isFatal(), iri, OboFormatTag.TAG_INTERSECTION_OF.getTag()));
}
}
}
示例4: getSvfClasses
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
Set<OWLClass> getSvfClasses(OWLClass c, OWLObjectProperty p) {
Set<OWLSubClassOfAxiom> axioms = new HashSet<OWLSubClassOfAxiom>();
for(OWLOntology ont : getAllOntologies()) {
axioms.addAll(ont.getSubClassAxiomsForSubClass(c));
}
Set<OWLClass> superClasses = new HashSet<OWLClass>();
for (OWLSubClassOfAxiom axiom : axioms) {
OWLClassExpression expr = axiom.getSuperClass();
if (expr instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom) expr;
if (p.equals(svf.getProperty())) {
OWLClassExpression filler = svf.getFiller();
if (filler instanceof OWLClass) {
superClasses.add((OWLClass) filler);
}
}
}
}
return superClasses;
}
示例5: renderAdditionalNodeExpression
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
private void renderAdditionalNodeExpression(StringBuilder line, OWLClassExpression expression, OWLPrettyPrinter owlpp, OWLGraphWrapper graph) {
if (expression instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom object = (OWLObjectSomeValuesFrom) expression;
OWLObjectPropertyExpression property = object.getProperty();
OWLClassExpression filler = object.getFiller();
line.append("<TR><TD>");
line.append(getLabel(property, owlpp, graph));
line.append("</TD><TD>");
line.append(getLabel(filler, owlpp, graph));
line.append("</TD></TR>");
}
else {
line.append("<TR><TD COLSPAN=\"2\">");
line.append(getLabel(expression, owlpp, graph));
line.append("</TD></TR>");
}
}
示例6: renderAdditionalNodeExpression
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
private void renderAdditionalNodeExpression(StringBuilder line, OWLClassExpression expression, OWLPrettyPrinter owlpp) {
if (expression instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom object = (OWLObjectSomeValuesFrom) expression;
OWLObjectPropertyExpression property = object.getProperty();
OWLClassExpression filler = object.getFiller();
line.append("<TR><TD>");
line.append(getLabel(property, owlpp));
line.append("</TD><TD>");
line.append(getLabel(filler, owlpp));
line.append("</TD></TR>");
}
else {
line.append("<TR><TD COLSPAN=\"2\">");
line.append(getLabel(expression, owlpp));
line.append("</TD></TR>");
}
}
示例7: visit
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
@Override
public IntegerClassExpression visit(OWLObjectSomeValuesFrom ce) {
Objects.requireNonNull(ce);
IntegerObjectPropertyExpression propertyExpr = ce.getProperty().accept(getObjectPropertyExpressionTranslator());
OWLClassExpression desc = ce.getFiller();
IntegerClassExpression classExpression = desc.accept(this);
return getDataTypeFactory().createObjectSomeValuesFrom(propertyExpr, classExpression);
}
示例8: visit
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
public OWLClassExpression visit(OWLObjectSomeValuesFrom object) {
m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(object.getProperty().getNamedProperty());
OWLClassExpression filler=object.getFiller();
if (isSimple(filler) || isNominal(filler))
// The ObjectOneof cases is an optimization.
return object;
else {
OWLClassExpression definition=getDefinitionFor(filler,m_alreadyExists);
if (!m_alreadyExists[0])
m_newInclusions.add(new OWLClassExpression[] { negative(definition),filler });
return m_factory.getOWLObjectSomeValuesFrom(object.getProperty(),definition);
}
}
示例9: visit
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
* According to the naive translation:<br/>
* <br/>
* <code>naive(Exists r.A) := not r(X,Y), A(Y)</code>
*
* @see org.semanticweb.owlapi.model.OWLClassExpressionVisitor#visit(org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom)
*/
public void visit(OWLObjectSomeValuesFrom objExistential) {
// we require normalized axioms, therefore we can do the following
OWLObjectPropertyExpression property = objExistential.getProperty();
OWLClassExpression fillerClass = objExistential.getFiller();
OWLObjectMinCardinality minCard = new OWLObjectMinCardinalityImpl(property, 1, fillerClass);
visit(minCard);
}
示例10: checkPotentialRedundantSubClassAxioms
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
* Check all classes for potential redundant subClass axioms of type:
* <pre>
* A SubClassOf R some B
* and
* A SubClassOf B
* </pre>
*
* @return list of axiom pairs
*/
public List<PotentialRedundant> checkPotentialRedundantSubClassAxioms() {
List<PotentialRedundant> result = new ArrayList<PotentialRedundant>();
for(OWLClass cls : graph.getAllOWLClasses()) {
Set<OWLSubClassOfAxiom> axioms = graph.getAllOWLSubClassOfAxiomsForSubClass(cls);
if (axioms.size() > 1) {
// only check sets with more than one axiom
for (OWLSubClassOfAxiom main : axioms) {
OWLClassExpression mainSuperClassCE = main.getSuperClass();
if (mainSuperClassCE.isAnonymous()) {
continue;
}
OWLClass mainSuperClass = mainSuperClassCE.asOWLClass();
for (OWLSubClassOfAxiom current : axioms) {
if (main == current) {
continue;
}
OWLClassExpression currentSuperClass = current.getSuperClass();
if (currentSuperClass.isAnonymous() && currentSuperClass instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom someValuesFrom = (OWLObjectSomeValuesFrom) currentSuperClass;
final OWLClassExpression filler = someValuesFrom.getFiller();
if (mainSuperClass.equals(someValuesFrom.getFiller())) {
final OWLObjectPropertyExpression property = someValuesFrom.getProperty();
final OWLClassExpression subClass = current.getSubClass();
final PotentialRedundant redundant = new PotentialRedundant(main, current, subClass.asOWLClass(), property.asOWLObjectProperty(), filler.asOWLClass());
result.add(redundant);
}
}
}
}
}
}
if (!result.isEmpty()) {
return result;
}
return null;
}
示例11: classifyRelationship
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
* Classify the an edge and target as a human readable string for further processing.
*
* @param owlGraphEdge edge under consideration
* @param edgeDirector
* @param props properties set
* @return null, "simplesubclass", "typesubclass", or "identity".
* @see #addDirectDescendentsToShuntGraph
* @see #addStepwiseAncestorsToShuntGraph
*/
public String classifyRelationship(OWLGraphEdge owlGraphEdge, OWLObject edgeDirector, Set<? extends OWLPropertyExpression> props){
String retval = null;
OWLQuantifiedProperty qp = owlGraphEdge.getSingleQuantifiedProperty();
if( qp.isSubClassOf() || props.contains(qp.getProperty()) ){
//OWLObject target = owlGraphEdge.getTarget();
if( edgeDirector instanceof OWLClass ){
retval = "simplesubclass";
}else if( edgeDirector instanceof OWLObjectSomeValuesFrom ){
OWLObjectSomeValuesFrom some = (OWLObjectSomeValuesFrom)edgeDirector;
if( props.contains(some.getProperty()) ){
OWLClassExpression clsexp = some.getFiller();
if( ! clsexp.isAnonymous()){
retval = "typesubclass";
}
}
}
}else if( qp.isIdentity() ){
retval = "identity";
}else{
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping complex edge: "+owlGraphEdge);
}
}
return retval;
}
示例12: expand
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
* Create the GCIs for BioChEBI. Add the axioms into the given ontology.
*
* @param ontology
* @param ignoredClasses
*/
public void expand(OWLOntology ontology, Set<OWLClass> ignoredClasses) {
final OWLOntologyManager manager = ontology.getOWLOntologyManager();
final OWLDataFactory factory = manager.getOWLDataFactory();
// scan axioms
Set<OWLSubClassOfAxiom> axioms = ontology.getAxioms(AxiomType.SUBCLASS_OF, Imports.INCLUDED);
for (OWLSubClassOfAxiom axiom : axioms) {
OWLClassExpression superCE = axiom.getSuperClass();
OWLClassExpression subCE = axiom.getSubClass();
if (subCE.isAnonymous()) {
// sub class needs to be an named OWLClass
continue;
}
if (superCE instanceof OWLObjectSomeValuesFrom == false) {
continue;
}
OWLObjectSomeValuesFrom some = (OWLObjectSomeValuesFrom) superCE;
OWLObjectPropertyExpression expression = some.getProperty();
if (expression.isAnonymous()) {
// object property expression needs to be a named OWLObjectProperty
continue;
}
OWLObjectProperty p = (OWLObjectProperty) expression;
Set<OWLObjectProperty> expansions = expansionMap.get(p);
if (expansions == null) {
continue;
}
// get content for GCI
OWLClassExpression y = some.getFiller();
OWLClass x = subCE.asOWLClass();
if (ignoredClasses.contains(x)) {
continue;
}
for (OWLObjectProperty createProperty : expansions) {
OWLClassExpression ce1 = factory.getOWLObjectSomeValuesFrom(createProperty, x);
OWLClassExpression ce2 = factory.getOWLObjectSomeValuesFrom(createProperty, y);
OWLEquivalentClassesAxiom eq = factory.getOWLEquivalentClassesAxiom(ce1, ce2);
manager.addAxiom(ontology, eq);
}
}
Set<OWLOntology> imports = ontology.getImports();
StringBuilder sb = new StringBuilder();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
sb.append("Generated on ").append(dateFormat.format(new Date())).append(" using the following import chain:");
for (OWLOntology owlOntology : imports) {
OWLOntologyID ontologyID = owlOntology.getOntologyID();
sb.append(" ");
appendOntologyId(ontologyID, sb);
}
addComment(sb.toString(), ontology);
}
示例13: unfold
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
* given an annotation to a pre-existing term,
* this will return a set of zero or more annotations to new terms that are generated from
* folding the annotation extensions into newly created term
*
* @param gdoc
* @param ann
* @return annotations
* @throws MultipleUnfoldOptionsException
*/
public Collection<GeneAnnotation> unfold(GafDocument gdoc, GeneAnnotation ann) throws MultipleUnfoldOptionsException {
List<GeneAnnotation> newAnns = new ArrayList<GeneAnnotation>();
OWLOntology ont = graph.getSourceOntology();
OWLClass annotatedToClass = getOWLClass(ann.getCls());
// c16
List<List<ExtensionExpression>> preExistingExtExprs = ann.getExtensionExpressions();
OWLClassExpression x = unfold(ont, annotatedToClass);
List<ExtensionExpression> unfolded = new ArrayList<ExtensionExpression>();
OWLClass genus = null;
if (x != null) {
if (x instanceof OWLObjectIntersectionOf) {
for (OWLClassExpression op : ((OWLObjectIntersectionOf)x).getOperands()) {
if (op instanceof OWLClass) {
genus = (OWLClass) op;
}
else if (op instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)op;
if (svf.getFiller().isAnonymous()) {
return null;
}
OWLClass c = (OWLClass)svf.getFiller();
// TODO
String p = graph.getLabel(svf.getProperty());
if (p == null)
p = graph.getIdentifier(svf.getProperty());
else
p = p.replaceAll(" ","_");
String y = graph.getIdentifier(c);
unfolded.add(new ExtensionExpression(p, y));
}
else {
return null;
}
}
}
}
if (unfolded.size() > 0) {
LOG.info("UNFOLD: "+ann.getCls()+" -> " + genus+" exts: "+unfolded);
GeneAnnotation newAnn = new GeneAnnotation(ann);
if (preExistingExtExprs == null || preExistingExtExprs.isEmpty()) {
newAnn.setExtensionExpressions(Collections.singletonList(unfolded));
}
else {
// add the unfolded intersections to the pre-existing c16 data
List<List<ExtensionExpression>> combined = new ArrayList<List<ExtensionExpression>>(preExistingExtExprs.size());
for(List<ExtensionExpression> preExistingGroup : preExistingExtExprs) {
List<ExtensionExpression> combinedGroup = new ArrayList<ExtensionExpression>(preExistingGroup.size()+unfolded.size());
combinedGroup.addAll(unfolded);
combinedGroup.addAll(preExistingGroup);
combined.add(combinedGroup);
}
newAnn.setExtensionExpressions(combined);
}
if (isReplaceGenus && genus != null) {
newAnn.setCls(graph.getIdentifier(genus));
}
newAnns.add(newAnn);
}
return newAnns;
}
示例14: hasMatchingIntersection
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
* Search for the first class with a matching equivalent class definition.
*
* @param c
* @param genus
* @param relation
* @return match or null
*/
private OWLClass hasMatchingIntersection(OWLClass c, OWLClass genus, OWLObjectProperty relation) {
for(OWLOntology o : allOntologies) {
Set<OWLEquivalentClassesAxiom> eqAxioms = o.getEquivalentClassesAxioms(c);
for (OWLEquivalentClassesAxiom eqAxiom : eqAxioms) {
Set<OWLClassExpression> expressions = eqAxiom.getClassExpressionsMinus(c);
for (OWLClassExpression expression : expressions) {
if (expression instanceof OWLObjectIntersectionOf) {
OWLObjectIntersectionOf intersection = (OWLObjectIntersectionOf) expression;
OWLClass differentiaCls = null;
boolean matchesGenus = false;
boolean matchesRelation = false;
Set<OWLClassExpression> operands = intersection.getOperands();
if (operands.size() == 2) {
for (OWLClassExpression operand : operands) {
if (operand.isAnonymous() == false) {
OWLClass currentGenus = operand.asOWLClass();
if (genus.equals(currentGenus)) {
matchesGenus = true;
}
}
else if (operand instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom differentia = (OWLObjectSomeValuesFrom) operand;
if (relation.equals(differentia.getProperty())) {
matchesRelation = true;
OWLClassExpression filler = differentia.getFiller();
if (!filler.isAnonymous() && !filler.isOWLNothing() && !filler.isOWLThing()) {
differentiaCls = filler.asOWLClass();
}
}
}
}
if (matchesGenus && matchesRelation ) {
return differentiaCls;
}
}
}
}
}
}
return null;
}
示例15: getSubClassOfSomeValuesFromAxioms
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom; //导入方法依赖的package包/类
/**
* Generates trivial SVF axioms from existing GCIs
*
* <pre>
* For each GCI of the form CX SubClassOf R some DX
* for each C that is an inferred direct subclass of or equivalent to CX
* for each D that is an inferred direct superclass of or equivalent to DX
* add an axiom C SubClassOf R some D
* </pre>
* @param ontology
* @param reasoner
* @return axioms
*/
public static Set<OWLSubClassOfAxiom> getSubClassOfSomeValuesFromAxioms(OWLOntology ontology,
OWLReasoner reasoner) {
Set<OWLSubClassOfAxiom> axioms = new HashSet<OWLSubClassOfAxiom>();
OWLDataFactory df = ontology.getOWLOntologyManager().getOWLDataFactory();
for (OWLSubClassOfAxiom ax : ontology.getAxioms(AxiomType.SUBCLASS_OF)) {
OWLClassExpression c = ax.getSubClass();
if (ax.getSuperClass() instanceof OWLObjectSomeValuesFrom) {
OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)ax.getSuperClass();
OWLObjectPropertyExpression p = svf.getProperty();
OWLClassExpression filler = svf.getFiller();
if (filler.isAnonymous() || c.isAnonymous()) {
if (c.isBottomEntity())
continue;
if (filler.isTopEntity())
continue;
Set<OWLClass> childSet = reasoner.getEquivalentClasses(c).getEntities();
if (childSet.size() == 0) {
childSet = reasoner.getSubClasses(c, true).getFlattened();
}
for (OWLClass childClass : childSet) {
if (childClass.isBottomEntity())
continue;
Set<OWLClass> childClassSuperClasses =
reasoner.getSuperClasses(childClass, false).getFlattened();
childClassSuperClasses.addAll(reasoner.getEquivalentClasses(childClass).getEntities());
Set<OWLClass> parentSet = reasoner.getEquivalentClasses(filler).getEntities();
if (parentSet.size() == 0) {
parentSet = reasoner.getSuperClasses(filler, true).getFlattened();
}
// TODO: remove additional redundancy (R some X) SubClassOf (R some Y)
// Elk cannot test arbitrary entailments
for (OWLClass parentClass : parentSet) {
if (parentClass.isTopEntity())
continue;
// do not assert C SubClassOf part-of some D, if C SubClassOf D is entailed
if (childClassSuperClasses.contains(parentClass))
continue;
axioms.add(df.getOWLSubClassOfAxiom(childClass,
df.getOWLObjectSomeValuesFrom(p, parentClass)));
}
}
}
}
}
LOG.info("Inferred SVFs: "+axioms.size());
return axioms;
}