Package org.mindswap.pellet

Examples of org.mindswap.pellet.Literal


            return;

        // If not, we have to create it
        // If the role is a datatype property...
        if( role.isDatatypeRole() ) {
            Literal literal = (Literal) y;
      if( ATermUtils.isNominal( c ) && !PelletOptions.USE_PSEUDO_NOMINALS ) {
        strategy.getABox().copyOnWrite();

        final ATermAppl input = (ATermAppl) c.getArgument( 0 );
        ATermAppl canonical;
View Full Code Here


      if( !r.isDatatypeRole() )
        continue;

      ds = ds.union( e.getDepends(), strategy.getABox().doExplanation() );

      final Literal l = (Literal) e.getTo();
      pending.add( l );

      Set<Literal> disj = ne.get( l );

      for( Role s : r.getDisjointRoles() ) {
        for( Edge f : ind.getOutEdges().getEdges( s ) ) {
          final Literal k = (Literal) f.getTo();
          if( disj == null ) {
            disj = new HashSet<Literal>();
            ne.put( l, disj );
            nePresent = true;
          }
          disj.add( k );
        }
      }
    }
   
    while (!pending.isEmpty()) {
      final Literal l = pending.removeFirst();
      if( !nodes.add( l ) )
        continue;

      Set<Literal> disj = ne.get( l );

      for( Node n : l.getDifferents() ) {
        if( n.isLiteral() ) {
          final Literal k = (Literal) n;
          pending.add( k );
          if( disj == null ) {
            disj = new HashSet<Literal>();
            ne.put( l, disj );
            nePresent = true;
View Full Code Here

      //@Override
      public void setCurrentBinding(VariableBinding currentBinding) {
        if ( VariableUtils.isVariable( head ) ) {
          ATermAppl resultTerm = ATermUtils.makePlainLiteral( match );
          Literal resultLit = currentBinding.getABox().addLiteral( resultTerm );
          currentBinding.set( head, resultLit );
        }
      }
View Full Code Here

  public Collection<AtomVariable> getPrerequisiteVars( Collection<AtomVariable> bound ) {
    return VariableUtils.getVars( atom );
  }

  public void rebind(VariableBinding newBinding) {
    Literal dValue = newBinding.get( atom.getArgument() );

    if( dValue == null ) {
      throw new InternalReasonerException(
          "DataRangeBindingHelper cannot generate bindings for " + atom );
    }

    try {
      hasNext = dtReasoner.isSatisfiable( Collections.singleton( atom.getPredicate() ),
          dValue.getValue() );
    } catch( DatatypeReasonerException e ) {
      final String msg = "Unexpected datatype reasoner exception: " + e.getMessage();
      log.severe( msg );
      throw new InternalReasonerException( e );
    }
View Full Code Here

  }
 
  public Literal apply( ABox abox, Literal expected, Literal... args ) {
    Number expectedNum = null;
    Number result = null;
    Literal resultLit = null;
   
    if (expected != null) {
      if (!(expected.getValue() instanceof Number)) {
        ABox.log.info("Testing non-numeric against the result of a numeric function '"
                + function + "': " + expected);
View Full Code Here

        }
       
        if ( mergeResults( args, results ) )
          return true;
      } else if ( restBound( args ) ) {
        Literal result = allBound.apply( abox, args[0], argList( args ) );
        if ( result != null ) {
          if ( args[0] == null )
            args[0] = result;
          return true;
        }
View Full Code Here

    StringFunctionAdapter allBound = new StringFunctionAdapter( this, XSD + "dateTime" );
   
    public boolean apply(ABox abox, Literal[] args) {
      // Assume applicability check means we have the right number of arguments.
      if ( restBound( args ) ) {
        Literal result = allBound.apply( abox, args[0], argList( args ) );
        if ( result != null ) {
          if ( args[0] == null )
            args[0] = result;
          return true;
        }
View Full Code Here

      allBound = new StringFunctionAdapter( this, XSD + "duration" );
    }
   
    public boolean apply(ABox abox, Literal[] args) {
      if ( restBound( args ) ) {
        Literal result = allBound.apply( abox, args[0], argList( args ) );
        if ( result != null ) {
          if ( args[0] == null )
            args[0] = result;
          return true;
        }
View Full Code Here

      StringFunctionAdapter allBound = new StringFunctionAdapter( this, XSD + "time" );
     
      public boolean apply(ABox abox, Literal[] args) {
        if ( restBound( args ) ) {
          Literal result = allBound.apply( abox, args[0], argList( args ) );
          if ( result != null ) {
            if ( args[0] == null )
              args[0] = result;
            return true;
          }
View Full Code Here

    return new FunctionHelper( atom );
  }

  @Override
  public boolean apply(ABox abox, Literal[] args) {
      Literal result = function.apply(abox, args[0], Arrays.copyOfRange(args, 1, args.length));     
      args[0] = result;
      return result != null;
  }
View Full Code Here

TOP

Related Classes of org.mindswap.pellet.Literal

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.