Package com.clarkparsia.pellet.rules.model

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


    public FunctionHelper( BuiltInAtom atom ) {
      this.atom = atom;
    }
   
    public Collection<? extends AtomVariable> getBindableVars( Collection<AtomVariable> bound ) {
      AtomDObject head = null;
      for ( AtomDObject obj : atom.getAllArguments() ) {
        if (head == null) {
          head = obj;
          // Can only bind first argument to a function
          if ( !VariableUtils.isVariable( head ) )
            return Collections.emptySet();
        } else {
          // Cannot bind a variable that occurs in multiple places.
          if ( head.equals( obj ) )
            return Collections.emptySet();
        }
      }
      if ( head == null )
        return Collections.emptySet();
View Full Code Here


                }
      }
      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 );
                }

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

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

        if( pred == null || !defineDatatypeProperty( 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 DatavaluedPropertyAtom( pred, argument1, argument2 );
                }
      }
      else if( hasObject( atomNode, RDF.type.asNode(), SWRL.BuiltinAtom.asNode() ) ) {
        atomType = "BuiltinAtom";
        Node builtInNode = null;
        List<AtomDObject> arguments = null;

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

        builtInNode = getObject( atomNode, SWRL.builtin.asNode() );

        if( arguments == null ) {
                  addUnsupportedFeature( "Term not found " + SWRL.arguments );
                }
                else if( builtInNode != null && builtInNode.isURI() ) {
                  atom = new BuiltInAtom( builtInNode.getURI(), arguments );
                }
      }
      else if( hasObject( atomNode, RDF.type.asNode(), SWRL.DataRangeAtom.asNode() ) ) {
        atomType = "DataRangeAtom";
        ATermAppl datatype = null;
        AtomDObject argument = null;

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

        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 );
      }
View Full Code Here

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

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

    atom.getPredicate().accept( this );
    swrlAtom = new DatavaluedPropertyAtom( term, subj, obj );
  }
View Full Code Here

          }
        }
        else {
          varCount++;
          if( kb.isDatatypeProperty( p ) ) {
            AtomDObject newVar = new AtomDVariable( "var" + varCount );
            RuleAtom atom = new DatavaluedPropertyAtom( p, var, newVar );
            atoms.add(atom);
            processDatatype( newVar, filler, atoms );
          }
          else{
View Full Code Here

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

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

    atom.getPredicate().accept( this );
    swrlAtom = new DatavaluedPropertyAtom( term, subj, obj );
  }
View Full Code Here

                }
      }
      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 );
                }

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

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

        if( pred == null || !defineDatatypeProperty( 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 DatavaluedPropertyAtom( pred, argument1, argument2 );
                }
      }
      else if( hasObject( atomNode, RDF.type.asNode(), SWRL.BuiltinAtom.asNode() ) ) {
        atomType = "BuiltinAtom";
        Node builtInNode = null;
        List<AtomDObject> arguments = null;

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

        builtInNode = getObject( atomNode, SWRL.builtin.asNode() );

        if( arguments == null ) {
                  addUnsupportedFeature( "Term not found " + SWRL.arguments );
                }
                else if( builtInNode != null && builtInNode.isURI() ) {
                  atom = new BuiltInAtom( builtInNode.getURI(), arguments );
                }
      }
      else if( hasObject( atomNode, RDF.type.asNode(), SWRL.DataRangeAtom.asNode() ) ) {
        atomType = "DataRangeAtom";
        ATermAppl datatype = null;
        AtomDObject argument = null;

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

    public FunctionHelper( BuiltInAtom atom ) {
      this.atom = atom;
    }
   
    public Collection<? extends AtomVariable> getBindableVars( Collection<AtomVariable> bound ) {
      AtomDObject head = null;
      for ( AtomDObject obj : atom.getAllArguments() ) {
        if (head == null) {
          head = obj;
          // Can only bind first argument to a function
          if ( !VariableUtils.isVariable( head ) )
            return Collections.emptySet();
        } else {
          // Cannot bind a variable that occurs in multiple places.
          if ( head.equals( obj ) )
            return Collections.emptySet();
        }
      }
      if ( head == null )
        return Collections.emptySet();
View Full Code Here

      }
     
      if ( function.apply( newBinding.getABox(), arguments ) ) {
        VariableBinding newPartial = new VariableBinding( newBinding.getABox() );
        for ( int i = 0; i < arguments.length; i++ ) {
          AtomDObject arg = atom.getAllArguments().get( i );
          Literal result = arguments[ i ];
          Literal current = newBinding.get( arg );
         
          if ( current != null && !current.equals( result ) ) {
            // Oops, we overwrote an argument.
View Full Code Here

        }
      }
      else {
        varCount++;
        if( kb.isDatatypeProperty( p ) ) {
          AtomDObject newVar = new AtomDVariable( "var" + varCount );
          RuleAtom atom = new DatavaluedPropertyAtom( p, var, newVar );
          atoms.add(atom);
          processDatatype( newVar, filler, atoms );
        }
        else{
View Full Code Here

TOP

Related Classes of com.clarkparsia.pellet.rules.model.AtomDObject

Copyright © 2018 www.massapicom. 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.