Package org.openjena.atlas.json

Examples of org.openjena.atlas.json.JsonValue


            args = new String[] {"-"} ;

        try {
            for ( String fn : args )
            {
                JsonValue json = JSON.readAny(fn) ;
                JSON.write(IndentedWriter.stdout, json) ;
                IndentedWriter.stdout.ensureStartOfLine() ;
            }
        } finally { IndentedWriter.stdout.flush() ; }
    }
View Full Code Here


        Iterator<JsonValue> iter = array.iterator() ;
       
        for ( ; iter.hasNext() ; )
        {
            BindingMap b = BindingFactory.create() ;
            JsonValue v = iter.next() ;
            if ( ! v.isObject() )
                throw new ResultSetException("Entry in 'bindings' array must be an object {}";
            JsonObject x = v.getAsObject() ;
            Set<String> varNames = x.keys() ;
            for ( String vn : varNames )
            {
                if ( ! vars.contains(vn) )
                    ; // Warning
                JsonValue vt = x.get(vn) ;
                if ( ! vt.isObject() )
                    throw new ResultSetException("Binding for variable '"+vn+"' is not a JSON object: "+vt;
                Node n = parseOneTerm(vt.getAsObject()) ;
                b.add(Var.alloc(vn), n) ;
            }
            rows.add(b) ;
        }
    }
View Full Code Here

        JsonArray a = obj.get(kVars).getAsArray() ;
        Iterator<JsonValue> iter = a.iterator() ;
        List<Var> vars = new ArrayList<Var>() ;
        for ( ; iter.hasNext() ; )
        {
            JsonValue v = iter.next() ;
            if ( ! v.isString() )
                throw new ResultSetException("Entries in vars array must be strings") ;
            Var var = Var.alloc(v.getAsString().value()) ;
            vars.add(var) ;
        }
        return vars ;
    }
View Full Code Here

        throw new ResultSetException("Object key not recognized as valid for an RDF term: "+term) ;
    }
   
    private static String stringOrNull(JsonObject obj, String key)
    {
        JsonValue v = obj.get(key) ;
        if ( v == null ) return null ;
        if ( ! v.isString() )
            throw new ResultSetException("Not a string: key: "+key) ;
        return v.getAsString().value();
       
    }
View Full Code Here

            args = new String[] {"-"} ;

        try {
            for ( String fn : args )
            {
                JsonValue json =null ;
                try {
                 json = JSON.readAny(fn) ;
                } catch (JsonParseException ex)
                {
                    String name = fn.equals("-") ? "<stdin>" : fn ;
View Full Code Here

TOP

Related Classes of org.openjena.atlas.json.JsonValue

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.