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

项目:HermiT-android    文件:OWLNormalization.java   
public void visit(SWRLClassAtom atom) {
    if (!(atom.getArgument() instanceof SWRLIndividualArgument))
        throw new IllegalArgumentException("A SWRL rule contains a head atom "+atom+" with a variable that does not occur in the body. ");
    OWLIndividual ind=((SWRLIndividualArgument)atom.getArgument()).getIndividual();
    if (ind.isAnonymous())
        throwAnonIndError(atom);
    if (!isSimple(atom.getPredicate())) {
        OWLClassExpression definition=getDefinitionFor(atom.getPredicate(),m_alreadyExists);
        if (!m_alreadyExists[0])
            m_newInclusions.add(new OWLClassExpression[] { negative(definition),atom.getPredicate() });
        addFact(m_factory.getOWLClassAssertionAxiom(definition,ind.asOWLNamedIndividual()));
    }
    else
        addFact(m_factory.getOWLClassAssertionAxiom(atom.getPredicate(),ind.asOWLNamedIndividual()));
}
项目:HermiT-android    文件:OWLNormalization.java   
public void visit(SWRLObjectPropertyAtom atom) {
    if (!(atom.getFirstArgument() instanceof SWRLIndividualArgument) || !(atom.getSecondArgument() instanceof SWRLIndividualArgument))
        throwVarError(atom);
    OWLObjectPropertyExpression ope=atom.getPredicate().getSimplified();
    OWLIndividual first=((SWRLIndividualArgument)atom.getFirstArgument()).getIndividual();
    OWLIndividual second=((SWRLIndividualArgument)atom.getSecondArgument()).getIndividual();
    if (first.isAnonymous() || second.isAnonymous())
        throwAnonIndError(atom);
    if (ope.isAnonymous())
        addFact(m_factory.getOWLObjectPropertyAssertionAxiom(ope.getNamedProperty(),second.asOWLNamedIndividual(),first.asOWLNamedIndividual()));
    else
        addFact(m_factory.getOWLObjectPropertyAssertionAxiom(ope.asOWLObjectProperty(),first.asOWLNamedIndividual(),second.asOWLNamedIndividual()));
}
项目:HermiT-android    文件:OWLNormalization.java   
public void visit(SWRLDataPropertyAtom atom) {
    if (!(atom.getSecondArgument() instanceof SWRLLiteralArgument))
        throwVarError(atom);
    if (!(atom.getFirstArgument() instanceof SWRLIndividualArgument))
        throwVarError(atom);
    OWLIndividual ind=((SWRLIndividualArgument)atom.getFirstArgument()).getIndividual();
    if (ind.isAnonymous())
        throwAnonIndError(atom);
    OWLLiteral lit=((SWRLLiteralArgument)atom.getSecondArgument()).getLiteral();
    addFact(m_factory.getOWLDataPropertyAssertionAxiom(atom.getPredicate().asOWLDataProperty(),ind.asOWLNamedIndividual(),lit));
}
项目:HermiT-android    文件:OWLNormalization.java   
public void visit(SWRLSameIndividualAtom atom) {
    Set<OWLNamedIndividual> inds=new HashSet<OWLNamedIndividual>();
    for (SWRLArgument arg : atom.getAllArguments()) {
        if (!(arg instanceof SWRLIndividualArgument))
            throwVarError(atom);
        OWLIndividual ind=((SWRLIndividualArgument)arg).getIndividual();
        if (ind.isAnonymous())
            throwAnonIndError(atom);
        inds.add(ind.asOWLNamedIndividual());
    }
    addFact(m_factory.getOWLSameIndividualAxiom(inds));
}
项目:HermiT-android    文件:OWLNormalization.java   
public void visit(SWRLDifferentIndividualsAtom atom) {
    Set<OWLNamedIndividual> inds=new HashSet<OWLNamedIndividual>();
    for (SWRLArgument arg : atom.getAllArguments()) {
        if (!(arg instanceof SWRLIndividualArgument))
            throwVarError(atom);
        OWLIndividual ind=((SWRLIndividualArgument)arg).getIndividual();
        if (ind.isAnonymous())
            throwAnonIndError(atom);
        inds.add(ind.asOWLNamedIndividual());
    }
    addFact(m_factory.getOWLDifferentIndividualsAxiom(inds));
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public void visit(SWRLClassAtom atom) {
    if (!(atom.getArgument() instanceof SWRLIndividualArgument))
        throw new IllegalArgumentException("A SWRL rule contains a head atom "+atom+" with a variable that does not occur in the body. ");
    OWLIndividual ind=((SWRLIndividualArgument)atom.getArgument()).getIndividual();
    if (ind.isAnonymous())
        throwAnonIndError(atom);
    if (!isSimple(atom.getPredicate())) {
        OWLClassExpression definition=getDefinitionFor(atom.getPredicate(),m_alreadyExists);
        if (!m_alreadyExists[0])
            m_newInclusions.add(new OWLClassExpression[] { negative(definition),atom.getPredicate() });
        addFact(m_factory.getOWLClassAssertionAxiom(definition,ind.asOWLNamedIndividual()));
    }
    else
        addFact(m_factory.getOWLClassAssertionAxiom(atom.getPredicate(),ind.asOWLNamedIndividual()));
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public void visit(SWRLObjectPropertyAtom atom) {
    if (!(atom.getFirstArgument() instanceof SWRLIndividualArgument) || !(atom.getSecondArgument() instanceof SWRLIndividualArgument))
        throwVarError(atom);
    OWLObjectPropertyExpression ope=atom.getPredicate().getSimplified();
    OWLIndividual first=((SWRLIndividualArgument)atom.getFirstArgument()).getIndividual();
    OWLIndividual second=((SWRLIndividualArgument)atom.getSecondArgument()).getIndividual();
    if (first.isAnonymous() || second.isAnonymous())
        throwAnonIndError(atom);
    if (ope.isAnonymous())
        addFact(m_factory.getOWLObjectPropertyAssertionAxiom(ope.getNamedProperty(),second.asOWLNamedIndividual(),first.asOWLNamedIndividual()));
    else
        addFact(m_factory.getOWLObjectPropertyAssertionAxiom(ope.asOWLObjectProperty(),first.asOWLNamedIndividual(),second.asOWLNamedIndividual()));
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public void visit(SWRLDataPropertyAtom atom) {
    if (!(atom.getSecondArgument() instanceof SWRLLiteralArgument))
        throwVarError(atom);
    if (!(atom.getFirstArgument() instanceof SWRLIndividualArgument))
        throwVarError(atom);
    OWLIndividual ind=((SWRLIndividualArgument)atom.getFirstArgument()).getIndividual();
    if (ind.isAnonymous())
        throwAnonIndError(atom);
    OWLLiteral lit=((SWRLLiteralArgument)atom.getSecondArgument()).getLiteral();
    addFact(m_factory.getOWLDataPropertyAssertionAxiom(atom.getPredicate().asOWLDataProperty(),ind.asOWLNamedIndividual(),lit));
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public void visit(SWRLSameIndividualAtom atom) {
    Set<OWLNamedIndividual> inds=new HashSet<OWLNamedIndividual>();
    for (SWRLArgument arg : atom.getAllArguments()) {
        if (!(arg instanceof SWRLIndividualArgument))
            throwVarError(atom);
        OWLIndividual ind=((SWRLIndividualArgument)arg).getIndividual();
        if (ind.isAnonymous())
            throwAnonIndError(atom);
        inds.add(ind.asOWLNamedIndividual());
    }
    addFact(m_factory.getOWLSameIndividualAxiom(inds));
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public void visit(SWRLDifferentIndividualsAtom atom) {
    Set<OWLNamedIndividual> inds=new HashSet<OWLNamedIndividual>();
    for (SWRLArgument arg : atom.getAllArguments()) {
        if (!(arg instanceof SWRLIndividualArgument))
            throwVarError(atom);
        OWLIndividual ind=((SWRLIndividualArgument)arg).getIndividual();
        if (ind.isAnonymous())
            throwAnonIndError(atom);
        inds.add(ind.asOWLNamedIndividual());
    }
    addFact(m_factory.getOWLDifferentIndividualsAxiom(inds));
}
项目:Wolpertinger    文件:OWLNormalization.java   
public void visit(SWRLClassAtom atom) {
    if (!(atom.getArgument() instanceof SWRLIndividualArgument))
        throw new IllegalArgumentException("A SWRL rule contains a head atom "+atom+" with a variable that does not occur in the body. ");
    OWLIndividual ind=((SWRLIndividualArgument)atom.getArgument()).getIndividual();
    if (ind.isAnonymous())
        throwAnonIndError(atom);
    if (!isSimple(atom.getPredicate())) {
        OWLClassExpression definition=getDefinitionFor(atom.getPredicate(),m_alreadyExists);
        if (!m_alreadyExists[0])
            m_newInclusions.add(new OWLClassExpression[] { negative(definition),atom.getPredicate() });
        addFact(m_factory.getOWLClassAssertionAxiom(definition,ind.asOWLNamedIndividual()));
    }
    else
        addFact(m_factory.getOWLClassAssertionAxiom(atom.getPredicate(),ind.asOWLNamedIndividual()));
}
项目:Wolpertinger    文件:OWLNormalization.java   
public void visit(SWRLObjectPropertyAtom atom) {
    if (!(atom.getFirstArgument() instanceof SWRLIndividualArgument) || !(atom.getSecondArgument() instanceof SWRLIndividualArgument))
        throwVarError(atom);
    OWLObjectPropertyExpression ope=atom.getPredicate().getSimplified();
    OWLIndividual first=((SWRLIndividualArgument)atom.getFirstArgument()).getIndividual();
    OWLIndividual second=((SWRLIndividualArgument)atom.getSecondArgument()).getIndividual();
    if (first.isAnonymous() || second.isAnonymous())
        throwAnonIndError(atom);
    if (ope.isAnonymous())
        addFact(m_factory.getOWLObjectPropertyAssertionAxiom(ope.getNamedProperty(),second.asOWLNamedIndividual(),first.asOWLNamedIndividual()));
    else
        addFact(m_factory.getOWLObjectPropertyAssertionAxiom(ope.asOWLObjectProperty(),first.asOWLNamedIndividual(),second.asOWLNamedIndividual()));
}
项目:Wolpertinger    文件:OWLNormalization.java   
public void visit(SWRLDataPropertyAtom atom) {
    if (!(atom.getSecondArgument() instanceof SWRLLiteralArgument))
        throwVarError(atom);
    if (!(atom.getFirstArgument() instanceof SWRLIndividualArgument))
        throwVarError(atom);
    OWLIndividual ind=((SWRLIndividualArgument)atom.getFirstArgument()).getIndividual();
    if (ind.isAnonymous())
        throwAnonIndError(atom);
    OWLLiteral lit=((SWRLLiteralArgument)atom.getSecondArgument()).getLiteral();
    addFact(m_factory.getOWLDataPropertyAssertionAxiom(atom.getPredicate().asOWLDataProperty(),ind.asOWLNamedIndividual(),lit));
}
项目:Wolpertinger    文件:OWLNormalization.java   
public void visit(SWRLSameIndividualAtom atom) {
    Set<OWLNamedIndividual> inds=new HashSet<OWLNamedIndividual>();
    for (SWRLArgument arg : atom.getAllArguments()) {
        if (!(arg instanceof SWRLIndividualArgument))
            throwVarError(atom);
        OWLIndividual ind=((SWRLIndividualArgument)arg).getIndividual();
        if (ind.isAnonymous())
            throwAnonIndError(atom);
        inds.add(ind.asOWLNamedIndividual());
    }
    addFact(m_factory.getOWLSameIndividualAxiom(inds));
}
项目:Wolpertinger    文件:OWLNormalization.java   
public void visit(SWRLDifferentIndividualsAtom atom) {
    Set<OWLNamedIndividual> inds=new HashSet<OWLNamedIndividual>();
    for (SWRLArgument arg : atom.getAllArguments()) {
        if (!(arg instanceof SWRLIndividualArgument))
            throwVarError(atom);
        OWLIndividual ind=((SWRLIndividualArgument)arg).getIndividual();
        if (ind.isAnonymous())
            throwAnonIndError(atom);
        inds.add(ind.asOWLNamedIndividual());
    }
    addFact(m_factory.getOWLDifferentIndividualsAxiom(inds));
}
项目:owlapi-gwt    文件:SWRLIndividualArgumentImpl.java   
@Override
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof SWRLIndividualArgument)) {
        return false;
    }
    SWRLIndividualArgument other = (SWRLIndividualArgument) obj;
    return other.getIndividual().equals(getIndividual());
}
项目:HermiT-android    文件:OWLNormalization.java   
public void visit(SWRLIndividualArgument argument) {
}
项目: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    文件:OWLNormalization.java   
public void visit(SWRLIndividualArgument argument) {
    // nothing to do
}
项目:HermiT-android    文件:OWLClausification.java   
public Atom visit(SWRLIndividualArgument atom) {
    throw new IllegalStateException("Internal error: this part of the code is unused.");
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public void visit(SWRLIndividualArgument argument) {
}
项目: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    文件:OWLNormalization.java   
public void visit(SWRLIndividualArgument argument) {
    // nothing to do
}
项目:Hermit_1.3.8_android    文件:OWLClausification.java   
public Atom visit(SWRLIndividualArgument atom) {
    throw new IllegalStateException("Internal error: this part of the code is unused.");
}
项目:Wolpertinger    文件:OWLNormalization.java   
public void visit(SWRLIndividualArgument argument) {
}
项目: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()])));
    }
}
项目:Wolpertinger    文件:OWLNormalization.java   
public void visit(SWRLIndividualArgument argument) {
    // nothing to do
}
项目:owlapi-gwt    文件:OWLObjectVisitorExAdapter.java   
@Override
public O visit(SWRLIndividualArgument node) {
    return doDefault(node);
}
项目:owlapi-gwt    文件:OWLObjectVisitorAdapter.java   
@Override
public void visit(SWRLIndividualArgument node) {
    handleDefault(node);
}
项目:owlapi-gwt    文件:OWLObjectTypeIndexProvider.java   
@Override
public void visit(SWRLIndividualArgument node) {
    type = RULE_OBJECT_TYPE_INDEX_BASE + 7;
}
项目:owlapi-gwt    文件:SWRLVariableExtractor.java   
@Override
public void visit(SWRLIndividualArgument node) {}
项目:owlapi-gwt    文件:HashCode.java   
@Override
public void visit(SWRLIndividualArgument node) {
    hashCode = primes[68];
    hashCode = hashCode * MULT + node.getIndividual().hashCode();
}
项目:owlapi-gwt    文件:SWRLRuleImpl.java   
@Override
public SWRLIndividualArgument visit(SWRLIndividualArgument node) {
    return node;
}
项目:owlapi-gwt    文件:AbstractEntityRegistrationManager.java   
@Override
public void visit(@Nonnull SWRLIndividualArgument node) {
    node.getIndividual().accept(this);
}
项目:owlapi-gwt    文件:SWRLIndividualArgumentImpl.java   
@Override
protected int compareObjectOfSameType(OWLObject object) {
    return individual.compareTo(((SWRLIndividualArgument) object)
            .getIndividual());
}
项目:binaryowl    文件:SWRLIndividualArgumentSerializer.java   
@Override
protected void writeObject(SWRLIndividualArgument object, BinaryOWLOutputStream outputStream) throws IOException {
    outputStream.writeOWLObject(object.getIndividual());
}
项目:binaryowl    文件:SWRLIndividualArgumentSerializer.java   
@Override
protected SWRLIndividualArgument readObject(BinaryOWLInputStream inputStream) throws IOException, BinaryOWLParseException {
    OWLIndividual individual = inputStream.readOWLObject();
    return inputStream.getDataFactory().getSWRLIndividualArgument(individual);
}