Examples of AtomIObject


Examples of com.clarkparsia.pellet.rules.model.AtomIObject

      Node atomNode = getObject( atomList, RDF.first.asNode() );

      RuleAtom atom = null;
      if( hasObject( atomNode, RDF.type.asNode(), SWRL.ClassAtom.asNode() ) ) {
        ATermAppl description = null;
        AtomIObject argument = null;
        atomType = "ClassAtom";

        if( (obj = getObject( atomNode, SWRL.classPredicate.asNode() )) != null ) {
                  description = node2term( obj );
                }

        if( (obj = getObject( atomNode, SWRL.argument1.asNode() )) != null ) {
                  argument = createRuleIObject( obj );
                }

        if( description == null ) {
                  addUnsupportedFeature( "Error on " + SWRL.classPredicate );
                }
                else if( argument == null ) {
                  addUnsupportedFeature( "Error on" + SWRL.argument1 );
                }
                else {
                  atom = new ClassAtom( description, argument );
                }
      }
      else if( hasObject( atomNode, RDF.type.asNode(), SWRL.IndividualPropertyAtom.asNode() ) ) {
        ATermAppl pred = null;
        AtomIObject argument1 = null;
        AtomIObject argument2 = null;
        atomType = "IndividualPropertyAtom";

        if( (obj = getObject( atomNode, SWRL.propertyPredicate.asNode() )) != null ) {
                  pred = node2term( obj );
                }

        if( (obj = getObject( atomNode, SWRL.argument1.asNode() )) != null ) {
                  argument1 = createRuleIObject( obj );
                }

        if( (obj = getObject( atomNode, SWRL.argument2.asNode() )) != null ) {
                  argument2 = createRuleIObject( obj );
                }

        if( pred == null || !defineObjectProperty( pred ) ) {
                  addUnsupportedFeature( "Cannot define datatype property " + pred );
                }
                else if( argument1 == null ) {
                  addUnsupportedFeature( "Term not found: " + SWRL.argument1 );
                }
                else if( argument2 == null ) {
                  addUnsupportedFeature( "Term not found " + SWRL.argument2 );
                }
                else {
                  atom = new IndividualPropertyAtom( pred, argument1, argument2 );
                }
      }
      else if( hasObject( atomNode, RDF.type.asNode(), SWRL.DifferentIndividualsAtom.asNode() ) ) {
        AtomIObject argument1 = null;
        AtomIObject argument2 = null;
        atomType = "DifferentIndividualsAtom";

        if( (obj = getObject( atomNode, SWRL.argument1.asNode() )) != null ) {
                  argument1 = createRuleIObject( obj );
                }

        if( (obj = getObject( atomNode, SWRL.argument2.asNode() )) != null ) {
                  argument2 = createRuleIObject( obj );
                }

        if( argument1 == null ) {
                  addUnsupportedFeature( "Term not found " + SWRL.argument1 );
                }
                else if( argument2 == null ) {
                  addUnsupportedFeature( "Term not found " + SWRL.argument2 );
                }
                else {
                  atom = new DifferentIndividualsAtom( argument1, argument2 );
                }
      }
      else if( hasObject( atomNode, RDF.type.asNode(), SWRL.SameIndividualAtom.asNode() ) ) {
        AtomIObject argument1 = null;
        AtomIObject argument2 = null;
        atomType = "SameIndividualAtom";

        if( (obj = getObject( atomNode, SWRL.argument1.asNode() )) != null ) {
                  argument1 = createRuleIObject( obj );
                }

        if( (obj = getObject( atomNode, SWRL.argument2.asNode() )) != null ) {
                  argument2 = createRuleIObject( obj );
                }

        if( argument1 == null ) {
                  addUnsupportedFeature( "Term not found " + SWRL.argument1 );
                }
                else if( argument2 == null ) {
                  addUnsupportedFeature( "Term not found " + SWRL.argument2 );
                }
                else {
                  atom = new SameIndividualAtom( argument1, argument2 );
                }
      }
      else if( hasObject( atomNode, RDF.type.asNode(), SWRL.DatavaluedPropertyAtom.asNode() ) ) {
        ATermAppl pred = null;
        AtomIObject argument1 = null;
        AtomDObject argument2 = null;
        atomType = "DatavaluedPropertyAtom";

        if( (obj = getObject( atomNode, SWRL.propertyPredicate.asNode() )) != null ) {
                  pred = node2term( obj );
View Full Code Here

Examples of com.clarkparsia.pellet.rules.model.AtomIObject

  private RuleAtom convertRuleAtom(ATermAppl term) {
    RuleAtom atom = null;

    if( term.getAFun().equals( ATermUtils.TYPEFUN ) ) {
      ATermAppl i = (ATermAppl) term.getArgument( 0 );
      AtomIObject io = convertAtomIObject( i );
      ATermAppl c = (ATermAppl) term.getArgument( 1 );
     
      defineClass( c );
     
      atom = new ClassAtom( c, io );
    }
    else if( term.getAFun().equals( ATermUtils.PROPFUN ) ) {
      ATermAppl p = (ATermAppl) term.getArgument( 0 );
      ATermAppl i1 = (ATermAppl) term.getArgument( 1 );
      ATermAppl i2 = (ATermAppl) term.getArgument( 2 );
      AtomIObject io1 = convertAtomIObject( i1 );
     
      defineProperty( p );

      if( originalKB.isObjectProperty( p ) ) {
        kb.addObjectProperty( p );
        AtomIObject io2 = convertAtomIObject( i2 );
        atom = new IndividualPropertyAtom( p, io1, io2 );
      }
      else if( originalKB.isDatatypeProperty( p ) ) {
        kb.addDatatypeProperty( p );
        AtomDObject do2 = convertAtomDObject( i2 );
        atom = new DatavaluedPropertyAtom( p, io1, do2 );
      }
      else {
        throw new InternalReasonerException( "Unknown property " + p );
      }
    }
    else if( term.getAFun().equals( ATermUtils.SAMEASFUN ) ) {
      ATermAppl i1 = (ATermAppl) term.getArgument( 0 );
      ATermAppl i2 = (ATermAppl) term.getArgument( 1 );
      AtomIObject io1 = convertAtomIObject( i1 );
      AtomIObject io2 = convertAtomIObject( i2 );
     
      atom = new SameIndividualAtom( io1, io2 );     
    }
    else if( term.getAFun().equals( ATermUtils.DIFFERENTFUN ) ) {
      ATermAppl i1 = (ATermAppl) term.getArgument( 0 );
      ATermAppl i2 = (ATermAppl) term.getArgument( 1 );
      AtomIObject io1 = convertAtomIObject( i1 );
      AtomIObject io2 = convertAtomIObject( i2 );
     
      atom = new DifferentIndividualsAtom( io1, io2 );     
    }
    else if( term.getAFun().equals( ATermUtils.BUILTINFUN ) ) {
      ATermList args = (ATermList) term.getArgument( 0 );
View Full Code Here

Examples of com.clarkparsia.pellet.rules.model.AtomIObject

    OWLClassExpression c = atom.getPredicate();

    SWRLIArgument v = atom.getArgument();
    v.accept( this );

    AtomIObject subj = swrlIObject;

    c.accept( this );
    swrlAtom = new ClassAtom( term, subj );
  }
View Full Code Here

Examples of com.clarkparsia.pellet.rules.model.AtomIObject

      swrlAtom = null;
      return;
    }

    atom.getFirstArgument().accept( this );
    AtomIObject subj = swrlIObject;

    atom.getSecondArgument().accept( this );
    AtomIObject obj = swrlIObject;

    atom.getPredicate().accept( this );
    swrlAtom = new IndividualPropertyAtom( term, subj, obj );

  }
View Full Code Here

Examples of com.clarkparsia.pellet.rules.model.AtomIObject

      swrlAtom = null;
      return;
    }

    atom.getFirstArgument().accept( this );
    AtomIObject subj = swrlIObject;

    atom.getSecondArgument().accept( this );
    AtomDObject obj = swrlDObject;

    atom.getPredicate().accept( this );
View Full Code Here

Examples of com.clarkparsia.pellet.rules.model.AtomIObject

    swrlAtom = new DatavaluedPropertyAtom( term, subj, obj );
  }

  public void visit(SWRLSameIndividualAtom atom) {
    atom.getFirstArgument().accept( this );
    AtomIObject subj = swrlIObject;

    atom.getSecondArgument().accept( this );
    AtomIObject obj = swrlIObject;

    swrlAtom = new SameIndividualAtom( subj, obj );
  }
View Full Code Here

Examples of com.clarkparsia.pellet.rules.model.AtomIObject

  }

 
  public void visit(SWRLDifferentIndividualsAtom atom) {
    atom.getFirstArgument().accept( this );
    AtomIObject subj = swrlIObject;

    atom.getSecondArgument().accept( this );
    AtomIObject obj = swrlIObject;

    swrlAtom = new DifferentIndividualsAtom( subj, obj );
  }
View Full Code Here

Examples of com.clarkparsia.pellet.rules.model.AtomIObject

        // do not restore if we do not have any more branches to try.
        // after
        // backtrack the correct branch will restore it anyway. more
        // importantly restore clears the clash info causing exceptions
        if( tryNext < tryCount - 1 && clashDepends.contains( getBranch() ) ) {
          AtomIObject obj = (AtomIObject) (atom instanceof UnaryAtom
            ? ((UnaryAtom) atom).getArgument()
            : ((BinaryAtom) atom).getArgument1());
          Individual ind = binding.get( obj );

          strategy.restoreLocal( ind, this );
View Full Code Here

Examples of com.clarkparsia.pellet.rules.model.AtomIObject

        return false;
      }
     
      terms.remove( head );
     
      AtomIObject var = new AtomIVariable( "var");
      int varCount = 0;
      List<RuleAtom> bodyAtoms  = new ArrayList<RuleAtom>();
      for( ATermAppl term : terms ) {
        varCount = processClass( var, term, bodyAtoms, varCount );
      }
View Full Code Here

Examples of com.clarkparsia.pellet.rules.model.AtomIObject

            RuleAtom atom = new DatavaluedPropertyAtom( p, var, newVar );
            atoms.add(atom);
            processDatatype( newVar, filler, atoms );
          }
          else{
            AtomIObject newVar = new AtomIVariable( "var" + varCount );
            RuleAtom atom = new IndividualPropertyAtom( p, var, newVar );
            atoms.add(atom);
            varCount = processClass( newVar, filler, atoms, varCount );
          }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.