Package org.apache.marmotta.client.model.rdf

Examples of org.apache.marmotta.client.model.rdf.URI


     */
    public static RDFNode parseRDFJSONNode(Map<String, String> nodeDef) {
        RDFNode object;

        if( nodeDef.get(TYPE).equals(URI) ) {
            object = new URI(nodeDef.get(VALUE));
        } else if( nodeDef.get(TYPE).equals(BNODE) ) {
            object = new BNode(nodeDef.get(VALUE));
        } else {
            if( nodeDef.get(LANG) != null ) {
                object = new Literal(nodeDef.get(VALUE),nodeDef.get(LANG));
            } else if( nodeDef.get(DATATYPE) != null) {
                object = new Literal(nodeDef.get(VALUE),new URI(nodeDef.get(DATATYPE)));
            } else {
                object = new Literal(nodeDef.get(VALUE));
            }
        }
        return object;
View Full Code Here


     */
    public static RDFNode parseRDFJSONNode(Value value) {
        RDFNode object;

        if( value instanceof org.openrdf.model.URI ) {
            object = new URI(value.stringValue());
        } else if( value instanceof BNode ) {
            object = new BNode(value.stringValue());
        } else {
            org.openrdf.model.Literal literal = (org.openrdf.model.Literal)value;
            if( literal.getLanguage() != null ) {
                object = new Literal(literal.getLabel(), literal.getLanguage());
            } else if( literal.getDatatype() != null) {
                object = new Literal(literal.getLabel(),new URI(literal.getDatatype().stringValue()));
            } else {
                object = new Literal(literal.getLabel());
            }
        }
        return object;
View Full Code Here

                                    Binding nextBinding = nextRow.getBinding(nextBindingName);
                                    //Map<String,String> nodeDef = (Map<String,String>) entry.getValue();
                                    Value nodeDef = nextBinding.getValue();
                                    RDFNode node = null;
                                    if(nodeDef instanceof org.openrdf.model.URI) {
                                        node = new URI(nodeDef.stringValue());
                                    } else if(nodeDef instanceof org.openrdf.model.BNode) {
                                        node = new BNode(((org.openrdf.model.BNode)nodeDef).getID());
                                    } else if(nodeDef instanceof org.openrdf.model.Literal) {
                                        org.openrdf.model.Literal nodeLiteral = (org.openrdf.model.Literal)nodeDef;
                                        if(nodeLiteral.getLanguage() != null) {
                                            node = new Literal(nodeLiteral.getLabel(), nodeLiteral.getLanguage());
                                        } else if(nodeLiteral.getDatatype() != null) {
                                            node = new Literal(nodeLiteral.getLabel(), new URI(nodeLiteral.getDatatype().stringValue()));
                                        } else {
                                            node = new Literal(nodeLiteral.getLabel());
                                        }
                                    } else {
                                        log.error("unknown result node type: {}",nodeDef);
View Full Code Here

                                Map<String,RDFNode> row = new HashMap<String, RDFNode>();
                                for(Map.Entry<String,?> entry : ((Map<String,?>)o).entrySet()) {
                                    Map<String,String> nodeDef = (Map<String,String>) entry.getValue();
                                    RDFNode node = null;
                                    if("uri".equalsIgnoreCase(nodeDef.get("type"))) {
                                        node = new URI(nodeDef.get("value"));
                                    } else if("literal".equalsIgnoreCase(nodeDef.get("type")) ||
                                              "typed-literal".equalsIgnoreCase(nodeDef.get("type"))) {
                                        String lang = nodeDef.get("xml:lang");
                                        String datatype = nodeDef.get("datatype");

                                        if(lang != null) {
                                            node = new Literal(nodeDef.get("value"),lang);
                                        } else if(datatype != null) {
                                            node = new Literal(nodeDef.get("value"),new URI(datatype));
                                        } else {
                                            node = new Literal(nodeDef.get("value"));
                                        }
                                    } else if("bnode".equalsIgnoreCase(nodeDef.get("type"))) {
                                        node = new BNode(nodeDef.get("value"));
View Full Code Here

     */
    public static RDFNode parseRDFJSONNode(Map<String, String> nodeDef) {
        RDFNode object;

        if( nodeDef.get(TYPE).equals(TYPE_URI) ) {
            object = new URI(nodeDef.get(VALUE));
        } else if( nodeDef.get(TYPE).equals(TYPE_BNODE) ) {
            object = new BNode(nodeDef.get(VALUE));
        } else {
            if( nodeDef.get(LANG) != null ) {
                object = new Literal(nodeDef.get(VALUE),nodeDef.get(LANG));
            } else if( nodeDef.get(DATATYPE) != null) {
                object = new Literal(nodeDef.get(VALUE),new URI(nodeDef.get(DATATYPE)));
            } else {
                object = new Literal(nodeDef.get(VALUE));
            }
        }
        return object;
View Full Code Here

TOP

Related Classes of org.apache.marmotta.client.model.rdf.URI

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.