Java 类org.semanticweb.owlapi.model.SWRLRule 实例源码

项目:HermiT-android    文件:OWLNormalization.java   
public void processAxioms(Collection<? extends OWLAxiom> axioms) {
    AxiomVisitor axiomVisitor=new AxiomVisitor();
    for (OWLAxiom axiom : axioms)
        axiom.accept(axiomVisitor);
    // now all axioms are in NNF and converted into disjunctions wherever possible
    // exact cardinalities are rewritten into at least and at most cardinalities etc
    // Rules with multiple head atoms are rewritten into several rules (Lloyd-Topor transformation)

    // normalize rules, this might add new concept and data range inclusions
    // in case a rule atom uses a complex concept or data range
    // we keep this inclusions separate because they are only applied to named individuals
    RuleNormalizer ruleNormalizer=new RuleNormalizer(m_axioms.m_rules,axiomVisitor.m_classExpressionInclusionsAsDisjunctions,axiomVisitor.m_dataRangeInclusionsAsDisjunctions);
    for (SWRLRule rule : axiomVisitor.m_rules)
        ruleNormalizer.visit(rule);

    // in normalization, we now simplify the disjuncts where possible (eliminate
    // unnecessary conjuncts/disjuncts) and introduce fresh atomic concepts for complex
    // concepts m_axioms.m_conceptInclusions contains the normalized axioms after the normalization
    normalizeInclusions(axiomVisitor.m_classExpressionInclusionsAsDisjunctions,axiomVisitor.m_dataRangeInclusionsAsDisjunctions);
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public void processAxioms(Collection<? extends OWLAxiom> axioms) {
    AxiomVisitor axiomVisitor=new AxiomVisitor();
    for (OWLAxiom axiom : axioms)
        axiom.accept(axiomVisitor);
    // now all axioms are in NNF and converted into disjunctions wherever possible
    // exact cardinalities are rewritten into at least and at most cardinalities etc
    // Rules with multiple head atoms are rewritten into several rules (Lloyd-Topor transformation)

    // normalize rules, this might add new concept and data range inclusions
    // in case a rule atom uses a complex concept or data range
    // we keep this inclusions separate because they are only applied to named individuals
    RuleNormalizer ruleNormalizer=new RuleNormalizer(m_axioms.m_rules,axiomVisitor.m_classExpressionInclusionsAsDisjunctions,axiomVisitor.m_dataRangeInclusionsAsDisjunctions);
    for (SWRLRule rule : axiomVisitor.m_rules)
        ruleNormalizer.visit(rule);

    // in normalization, we now simplify the disjuncts where possible (eliminate
    // unnecessary conjuncts/disjuncts) and introduce fresh atomic concepts for complex
    // concepts m_axioms.m_conceptInclusions contains the normalized axioms after the normalization
    normalizeInclusions(axiomVisitor.m_classExpressionInclusionsAsDisjunctions,axiomVisitor.m_dataRangeInclusionsAsDisjunctions);
}
项目:Wolpertinger    文件:OWLNormalization.java   
public void processAxioms(Collection<? extends OWLAxiom> axioms) {
    AxiomVisitor axiomVisitor=new AxiomVisitor();

    for (OWLAxiom axiom : axioms) {
        axiom = preprocessAssertion(axiom);
        axiom.accept(axiomVisitor);
    }

    // now all axioms are in NNF and converted into disjunctions wherever possible
    // exact cardinalities are rewritten into at least and at most cardinalities etc
    // Rules with multiple head atoms are rewritten into several rules (Lloyd-Topor transformation)

    // normalize rules, this might add new concept and data range inclusions
    // in case a rule atom uses a complex concept or data range
    // we keep this inclusions separate because they are only applied to named individuals
    RuleNormalizer ruleNormalizer=new RuleNormalizer(m_axioms.m_rules,axiomVisitor.m_classExpressionInclusionsAsDisjunctions,axiomVisitor.m_dataRangeInclusionsAsDisjunctions);
    for (SWRLRule rule : axiomVisitor.m_rules)
        ruleNormalizer.visit(rule);

    // in normalization, we now simplify the disjuncts where possible (eliminate
    // unnecessary conjuncts/disjuncts) and introduce fresh atomic concepts for complex
    // concepts m_axioms.m_conceptInclusions contains the normalized axioms after the normalization
    normalizeInclusions(axiomVisitor.m_classExpressionInclusionsAsDisjunctions,axiomVisitor.m_dataRangeInclusionsAsDisjunctions);
}
项目:HermiT-android    文件:Reasoner.java   
protected static boolean isUnsupportedExtensionAxiom(OWLAxiom axiom) {
    return axiom instanceof OWLSubObjectPropertyOfAxiom
            || axiom instanceof OWLTransitiveObjectPropertyAxiom
            || axiom instanceof OWLSubPropertyChainOfAxiom
            || axiom instanceof OWLFunctionalObjectPropertyAxiom
            || axiom instanceof OWLInverseFunctionalObjectPropertyAxiom
            || axiom instanceof SWRLRule;
}
项目:Hermit_1.3.8_android    文件:Reasoner.java   
protected static boolean isUnsupportedExtensionAxiom(OWLAxiom axiom) {
    return axiom instanceof OWLSubObjectPropertyOfAxiom
            || axiom instanceof OWLTransitiveObjectPropertyAxiom
            || axiom instanceof OWLSubPropertyChainOfAxiom
            || axiom instanceof OWLFunctionalObjectPropertyAxiom
            || axiom instanceof OWLInverseFunctionalObjectPropertyAxiom
            || axiom instanceof SWRLRule;
}
项目:owlapi-gwt    文件:SWRLRuleImpl.java   
@Override
public SWRLRule getAxiomWithoutAnnotations() {
    if (!isAnnotated()) {
        return this;
    }
    return new SWRLRuleImpl(getBody(), getHead(), NO_ANNOTATIONS);
}
项目:owlapi-gwt    文件:SWRLRuleImpl.java   
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!super.equals(obj)) {
        return false;
    }
    if (!(obj instanceof SWRLRule)) {
        return false;
    }
    SWRLRule other = (SWRLRule) obj;
    return other.getBody().equals(body) && other.getHead().equals(head);
}
项目:owlapi-gwt    文件:SWRLRuleImpl.java   
@Override
protected int compareObjectOfSameType(OWLObject object) {
    SWRLRule other = (SWRLRule) object;
    int diff = compareSets(getBody(), other.getBody());
    if (diff == 0) {
        diff = compareSets(getHead(), other.getHead());
    }
    return diff;
}
项目:jopa    文件:IntegrityConstraintParser.java   
public void visit(SWRLRule axiom) {
    notSupported(axiom);
}
项目:HermiT-android    文件:OWLNormalization.java   
public AxiomVisitor() {
    m_classExpressionInclusionsAsDisjunctions=new ArrayList<OWLClassExpression[]>();
    m_dataRangeInclusionsAsDisjunctions=new ArrayList<OWLDataRange[]>();
    m_rules=new HashSet<SWRLRule>();
    m_alreadyExists=new boolean[1];
}
项目:HermiT-android    文件:OWLNormalization.java   
public void visit(SWRLRule rule) {
}
项目:HermiT-android    文件:OWLNormalization.java   
public void visit(SWRLRule rule) {
    // Process head one-by-one and thus break up the conjunction in the head.
    for (SWRLAtom headAtom : rule.getHead()) {
        m_individualsToVariables.clear();
        m_bodyAtoms.clear();
        m_headAtoms.clear();
        m_variableRepresentative.clear();
        m_normalizedBodyAtoms.clear();
        m_normalizedHeadAtoms.clear();
        m_bodyDataRangeVariables.clear();
        m_headDataRangeVariables.clear();

        // Initialize body with all atoms, and initialize head with just the atom we are processing.
        m_bodyAtoms.addAll(rule.getBody());
        m_headAtoms.add(headAtom);

        // First process sameIndividual in the body to set up variable normalizations.
        for (SWRLAtom atom : rule.getBody()) {
            if (atom instanceof SWRLSameIndividualAtom) {
                m_bodyAtoms.remove(atom);
                SWRLSameIndividualAtom sameIndividualAtom=(SWRLSameIndividualAtom)atom;
                SWRLVariable variable1=getVariableFor(sameIndividualAtom.getFirstArgument());
                SWRLIArgument argument2=sameIndividualAtom.getSecondArgument();
                if (argument2 instanceof SWRLVariable)
                    m_variableRepresentative.put((SWRLVariable)argument2,variable1);
                else {
                    OWLIndividual individual=((SWRLIndividualArgument)argument2).getIndividual();
                    if (individual.isAnonymous())
                        throw new IllegalArgumentException("Internal error: Rules with anonymous individuals are not supported. ");
                    m_individualsToVariables.put(individual.asOWLNamedIndividual(),variable1);
                    m_bodyAtoms.add(m_factory.getSWRLClassAtom(m_factory.getOWLObjectOneOf(individual),variable1));
                }
            }
        }

        // Now process head atoms; this might increase the number of body atoms.
        m_isPositive=true;
        while (!m_headAtoms.isEmpty())
            m_headAtoms.remove(0).accept(this);

        // Now process body atoms.
        m_isPositive=false;
        while (!m_bodyAtoms.isEmpty())
            m_bodyAtoms.remove(0).accept(this);

        // Do some checking and return the rule.
        if (!m_bodyDataRangeVariables.containsAll(m_headDataRangeVariables))
            throw new IllegalArgumentException("A SWRL rule contains data range variables in the head, but not in the body, and this is not supported.");
        m_rules.add(new OWLAxioms.DisjunctiveRule(m_normalizedBodyAtoms.toArray(new SWRLAtom[m_normalizedBodyAtoms.size()]),m_normalizedHeadAtoms.toArray(new SWRLAtom[m_normalizedHeadAtoms.size()])));
    }
}
项目:HermiT-android    文件:OWLClausification.java   
public Atom visit(SWRLRule rule) {
    throw new IllegalStateException("Internal error: this part of the code is unused.");
}
项目:HermiT-android    文件:EntailmentChecker.java   
public Boolean visit(SWRLRule rule) {
    throw new UnsupportedOperationException();
}
项目:HermiT-android    文件:EntailmentChecker.java   
public void visit(SWRLRule rule) {
}
项目:elk-reasoner    文件:AbstractOwlAxiomConverterVisitor.java   
@Override
public T visit(SWRLRule rule) {
    throw new IllegalArgumentException(SWRLRule.class.getSimpleName()
            + " cannot be converted to " + getTargetClass().getSimpleName());
}
项目:elk-reasoner    文件:OwlConverter.java   
@SuppressWarnings("static-method")
public ElkSWRLRule convert(SWRLRule rule) {
    return new ElkSWRLRuleWrap<SWRLRule>(rule);
}
项目:elk-reasoner    文件:OwlAxiomConverterVisitor.java   
@Override
public ElkAxiom visit(SWRLRule rule) {
    return CONVERTER.convert(rule);
}
项目:elk-reasoner    文件:FailingOwlAxiomVisitor.java   
@Override
public void visit(SWRLRule rule) {
    defaultVisit(rule);
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public AxiomVisitor() {
    m_classExpressionInclusionsAsDisjunctions=new ArrayList<OWLClassExpression[]>();
    m_dataRangeInclusionsAsDisjunctions=new ArrayList<OWLDataRange[]>();
    m_rules=new HashSet<SWRLRule>();
    m_alreadyExists=new boolean[1];
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public void visit(SWRLRule rule) {
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public void visit(SWRLRule rule) {
    // Process head one-by-one and thus break up the conjunction in the head.
    for (SWRLAtom headAtom : rule.getHead()) {
        m_individualsToVariables.clear();
        m_bodyAtoms.clear();
        m_headAtoms.clear();
        m_variableRepresentative.clear();
        m_normalizedBodyAtoms.clear();
        m_normalizedHeadAtoms.clear();
        m_bodyDataRangeVariables.clear();
        m_headDataRangeVariables.clear();

        // Initialize body with all atoms, and initialize head with just the atom we are processing.
        m_bodyAtoms.addAll(rule.getBody());
        m_headAtoms.add(headAtom);

        // First process sameIndividual in the body to set up variable normalizations.
        for (SWRLAtom atom : rule.getBody()) {
            if (atom instanceof SWRLSameIndividualAtom) {
                m_bodyAtoms.remove(atom);
                SWRLSameIndividualAtom sameIndividualAtom=(SWRLSameIndividualAtom)atom;
                SWRLVariable variable1=getVariableFor(sameIndividualAtom.getFirstArgument());
                SWRLIArgument argument2=sameIndividualAtom.getSecondArgument();
                if (argument2 instanceof SWRLVariable)
                    m_variableRepresentative.put((SWRLVariable)argument2,variable1);
                else {
                    OWLIndividual individual=((SWRLIndividualArgument)argument2).getIndividual();
                    if (individual.isAnonymous())
                        throw new IllegalArgumentException("Internal error: Rules with anonymous individuals are not supported. ");
                    m_individualsToVariables.put(individual.asOWLNamedIndividual(),variable1);
                    m_bodyAtoms.add(m_factory.getSWRLClassAtom(m_factory.getOWLObjectOneOf(individual),variable1));
                }
            }
        }

        // Now process head atoms; this might increase the number of body atoms.
        m_isPositive=true;
        while (!m_headAtoms.isEmpty())
            m_headAtoms.remove(0).accept(this);

        // Now process body atoms.
        m_isPositive=false;
        while (!m_bodyAtoms.isEmpty())
            m_bodyAtoms.remove(0).accept(this);

        // Do some checking and return the rule.
        if (!m_bodyDataRangeVariables.containsAll(m_headDataRangeVariables))
            throw new IllegalArgumentException("A SWRL rule contains data range variables in the head, but not in the body, and this is not supported.");
        m_rules.add(new OWLAxioms.DisjunctiveRule(m_normalizedBodyAtoms.toArray(new SWRLAtom[m_normalizedBodyAtoms.size()]),m_normalizedHeadAtoms.toArray(new SWRLAtom[m_normalizedHeadAtoms.size()])));
    }
}
项目:Hermit_1.3.8_android    文件:OWLClausification.java   
public Atom visit(SWRLRule rule) {
    throw new IllegalStateException("Internal error: this part of the code is unused.");
}
项目:Hermit_1.3.8_android    文件:EntailmentChecker.java   
public Boolean visit(SWRLRule rule) {
    throw new UnsupportedOperationException();
}
项目:Hermit_1.3.8_android    文件:EntailmentChecker.java   
public void visit(SWRLRule rule) {
}
项目:owltools    文件:AxiomAnnotationTools.java   
@Override
public OWLAxiom visit(SWRLRule rule) {
    return factory.getSWRLRule(rule.getBody(), rule.getHead(), annotations);
}
项目:owltools    文件:CardinalityContraintsTools.java   
@Override
public void visit(SWRLRule rule) {
}
项目:Wolpertinger    文件:OWLNormalization.java   
public AxiomVisitor() {
    m_classExpressionInclusionsAsDisjunctions=new ArrayList<OWLClassExpression[]>();
    m_dataRangeInclusionsAsDisjunctions=new ArrayList<OWLDataRange[]>();
    m_rules=new HashSet<SWRLRule>();
    m_alreadyExists=new boolean[1];
}
项目:Wolpertinger    文件:OWLNormalization.java   
public void visit(SWRLRule rule) {
}
项目:Wolpertinger    文件:OWLNormalization.java   
public void visit(SWRLRule rule) {
    // Process head one-by-one and thus break up the conjunction in the head.
    for (SWRLAtom headAtom : rule.getHead()) {
        m_individualsToVariables.clear();
        m_bodyAtoms.clear();
        m_headAtoms.clear();
        m_variableRepresentative.clear();
        m_normalizedBodyAtoms.clear();
        m_normalizedHeadAtoms.clear();
        m_bodyDataRangeVariables.clear();
        m_headDataRangeVariables.clear();

        // Initialize body with all atoms, and initialize head with just the atom we are processing.
        m_bodyAtoms.addAll(rule.getBody());
        m_headAtoms.add(headAtom);

        // First process sameIndividual in the body to set up variable normalizations.
        for (SWRLAtom atom : rule.getBody()) {
            if (atom instanceof SWRLSameIndividualAtom) {
                m_bodyAtoms.remove(atom);
                SWRLSameIndividualAtom sameIndividualAtom=(SWRLSameIndividualAtom)atom;
                SWRLVariable variable1=getVariableFor(sameIndividualAtom.getFirstArgument());
                SWRLIArgument argument2=sameIndividualAtom.getSecondArgument();
                if (argument2 instanceof SWRLVariable)
                    m_variableRepresentative.put((SWRLVariable)argument2,variable1);
                else {
                    OWLIndividual individual=((SWRLIndividualArgument)argument2).getIndividual();
                    if (individual.isAnonymous())
                        throw new IllegalArgumentException("Internal error: Rules with anonymous individuals are not supported. ");
                    m_individualsToVariables.put(individual.asOWLNamedIndividual(),variable1);
                    m_bodyAtoms.add(m_factory.getSWRLClassAtom(m_factory.getOWLObjectOneOf(individual),variable1));
                }
            }
        }

        // Now process head atoms; this might increase the number of body atoms.
        m_isPositive=true;
        while (!m_headAtoms.isEmpty())
            m_headAtoms.remove(0).accept(this);

        // Now process body atoms.
        m_isPositive=false;
        while (!m_bodyAtoms.isEmpty())
            m_bodyAtoms.remove(0).accept(this);

        // Do some checking and return the rule.
        if (!m_bodyDataRangeVariables.containsAll(m_headDataRangeVariables))
            throw new IllegalArgumentException("A SWRL rule contains data range variables in the head, but not in the body, and this is not supported.");
        m_rules.add(new OWLAxioms.DisjunctiveRule(m_normalizedBodyAtoms.toArray(new SWRLAtom[m_normalizedBodyAtoms.size()]),m_normalizedHeadAtoms.toArray(new SWRLAtom[m_normalizedHeadAtoms.size()])));
    }
}
项目:born    文件:CycleDetector.java   
@Override
public Boolean visit(SWRLRule axiom) {
    return true;
}
项目:born    文件:ElAxiomFilter.java   
@Override
public Boolean visit(SWRLRule axiom) {
    return false;
}
项目:born    文件:AnnotationProcessor.java   
@Override
public Boolean visit(SWRLRule rule) {
    Objects.requireNonNull(rule);
    return add(this.df.getSWRLRule(rule.getBody(), rule.getHead(), reg(rule.getAnnotations())));
}
项目:born    文件:AnnotationCreator.java   
@Override
public Boolean visit(SWRLRule rule) {
    Objects.requireNonNull(rule);
    return add(this.df.getSWRLRule(rule.getBody(), rule.getHead(), empty()));
}
项目:jcel    文件:AxiomTranslator.java   
@Override
public Set<ComplexIntegerAxiom> visit(SWRLRule axiom) {
    Objects.requireNonNull(axiom);
    throw TranslationException.newUnsupportedAxiomException(axiom);
}
项目:semantika    文件:TMappingProcessor.java   
@Override
public void visit(SWRLRule axiom)
{
   ignoreOwlAxiom("SWRLRule", axiom);
}
项目:OWL2SPARQL    文件:OWLAxiomToSPARQLConverter.java   
@Override
public void visit(SWRLRule rule) {
    LOGGER.warn("Ignoring axiom {} . Reason: SWRL rules not supported.", rule);
}
项目:owlapi-gwt    文件:OWLObjectVisitorExAdapter.java   
@Override
public O visit(SWRLRule rule) {
    return doDefault(rule);
}
项目:owlapi-gwt    文件:OWLObjectTypeIndexProvider.java   
@Override
public void visit(SWRLRule rule) {
    type = AXIOM_TYPE_INDEX_BASE + rule.getAxiomType().getIndex();
}
项目:owlapi-gwt    文件:NNF.java   
@Override
public OWLAxiom visit(SWRLRule rule) {
    return rule;
}