Package com.hp.jena.graph

Examples of com.hp.jena.graph.Node


public LessOrEqual( List<Node> nargs )
    { L = nargs.get( 0 ); R = nargs.get( 1 ); }

@Override public boolean evalBool( ExecContext c, Bindings<Node, Node> item )
    {
    Node lv = eval( item, L ), rv = eval( item, R );
    return
        isNumber( lv ) && isNumber( rv )
        && le( lv.getLiteralValue(), rv.getLiteralValue() );
    }
View Full Code Here


        D = nargs.size() == 4 ? nargs.get( 2 ) : null;
        }

    @Override public boolean evalBool( ExecContext c, Bindings<Node, Node> item )
        {
        Node xv = eval( item, X ), pv = eval( item, P );
        Node dv = D == null ? null : eval( item, D );
        if (dv == null)
            {
            throw new JenaException( "OOPS, we didn't do MakeInstance with no specified class" );
            }
        else
            {
            Object key = Pair.create( xv, Pair.create( pv, dv ) );
            Node already = bnodes.get( key );
            if (already == null) bnodes.put( key, already = c.createBNode() );
            return ApplyableBase.bind( item, T, already );
            }
        }
View Full Code Here

public LessThan( List<Node> nargs )
    { L = nargs.get( 0 ); R = nargs.get( 1 ); }

@Override public boolean evalBool( ExecContext c, Bindings<Node, Node> item )
    {
    Node lv = eval( item, L ), rv = eval( item, R );
    return
        isNumber( lv ) && isNumber( rv )
        && lt( lv.getLiteralValue(), rv.getLiteralValue() );
    }
View Full Code Here

public IsDType( List<Node> nargs )
    { val = nargs.get( 0 ); type = nargs.get( 1 ); }

@Override public boolean evalBool( ExecContext c, Bindings<Node, Node> item )
    {
    Node v = eval( item, val ), t = eval( item, type );
    if (!t.isIRI()) return false;
    if (v.isBlank()) return true;
    if (v.isLiteral())
        {
        RDFDatatype dtype = TypeMapper.getInstance().getSafeTypeByName(t.getIRI().asString() );
        RDFDatatype vType = v.getLiteralDatatype();
        return dtype != null && dtype.isValidLiteral( t.asLiteral() );
        }
    else
        return false;
    }
View Full Code Here

public NoValue( List<Node> nargs )
    { this.nargs = nargs; }

@Override public boolean evalBool( ExecContext c, Bindings<Node, Node> item )
  {
  Node S = eval( item, nargs.get(0) );
  Node P = nargs.size() < 2 ? Node.ANY : eval( item, nargs.get(1) );
    Node O = nargs.size() < 3 ? Node.ANY : eval( item, nargs.get(2) );
  return !c.contains( S, P, O );
  }
View Full Code Here

    public Min( List<Node> nargs )
        { A = nargs.get( 0 ); B = nargs.get( 1 ); min = nargs.get( 2 ); }
   
    @Override public boolean evalBool( ExecContext c, Bindings<Node, Node> item )
        {
        Node av = eval( item, A ), bv = eval( item, B );
        if (av.isLiteral() && bv.isLiteral())
            {
            Object va = av.getLiteralValue();
            Object vb = bv.getLiteralValue();
            if (va instanceof Number && vb instanceof Number)
                return ApplyableBase.bind( item, min, minOf( av, bv ) );
            else
                return false;
View Full Code Here

   
    private Node minOf( Node va, Node vb )
        {
        Number na = (Number) va.getLiteralValue();
        Number nb = (Number) vb.getLiteralValue();
        Node res =
            (na instanceof Float || na instanceof Double
            || nb instanceof Float || nb instanceof Double
            )
            ? na.doubleValue() > nb.doubleValue() ? va : vb
            : na.longValue() > nb.longValue() ? va : vb
View Full Code Here

        C = nargs.get( 2 );
        }

    @Override public boolean evalBool( ExecContext c, Bindings<Node, Node> item )
        {
        Node xv = eval( item, X ), pv = eval( item, P );
        int n = c.countDistinctValues( xv, pv );
        return ApplyableBase.bind( item, C, integerNode( n ) );
        }
View Full Code Here

public ListContains( List<Node> nargs )
    { list = nargs.get( 0 ); element = nargs.get( 1 ); }

@Override public boolean evalBool( ExecContext c, Bindings<Node, Node> item )
    {
    Node lv = evalitem, list ), ev = eval( item, element );
    return c.listContains( lv, ev );
    }
View Full Code Here

                NodeTerm predicate = boundTerm.getPredicate();
                if (predicate.isVariable())
                    bindersWithWildcardPredicate.add( b );
                else
                    {
                    Node p = predicate.subst( null, empty );
                    Set<Binder> bound = mapByFixedPredicate.get( p );
                    if (bound == null) mapByFixedPredicate.put( p, bound = new HashSet<Binder>() );
                    bound.add( b );
                    }
                }
View Full Code Here

TOP

Related Classes of com.hp.jena.graph.Node

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.