当前位置: 首页>>代码示例>>Java>>正文


Java JsonValue.isString方法代码示例

本文整理汇总了Java中org.apache.jena.atlas.json.JsonValue.isString方法的典型用法代码示例。如果您正苦于以下问题:Java JsonValue.isString方法的具体用法?Java JsonValue.isString怎么用?Java JsonValue.isString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jena.atlas.json.JsonValue的用法示例。


在下文中一共展示了JsonValue.isString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ResourceMapTemplate

import org.apache.jena.atlas.json.JsonValue; //导入方法依赖的package包/类
public ResourceMapTemplate(JsonObject spec, DataContext dc) {
    super(spec);
    root = new Pattern( getRequiredField(JSONConstants.ID), dc );
    for (Entry<String, JsonValue> entry : spec.entrySet()) {
        Pattern prop = new Pattern(entry.getKey(), dc);
        if (prop.isURI()) {
            JsonValue vals = entry.getValue();
            if (vals.isString()) {
                patterns.put( prop, new Pattern(vals.getAsString().value(), dc) );
            } else if (vals.isArray()) {
                for (Iterator<JsonValue> i =vals.getAsArray().iterator(); i.hasNext();) {
                    JsonValue val = i.next();
                    if (val.isString()) {
                        patterns.put( prop, new Pattern(val.getAsString().value(), dc) );
                    } else {
                        throw new EpiException("Resource map found non-string value pattern: " + val);
                    }
                }
            }
        }
    }
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:23,代码来源:ResourceMapTemplate.java

示例2: getTypeConstraints

import org.apache.jena.atlas.json.JsonValue; //导入方法依赖的package包/类
protected List<Resource> getTypeConstraints(JsonObject spec, ConverterProcess proc) {
    JsonValue jv = spec.get(JSONConstants.TYPE);
    if (jv == null) {
        return null;
    } else {
        List<Resource> constraints = new ArrayList<>();
        if (jv.isString()) {
            constraints.add( asResource(jv.getAsString().value(), proc) );
        } else if (jv.isArray()) {
            for (Iterator<JsonValue> i = jv.getAsArray().iterator(); i.hasNext();) {
                JsonValue v = i.next();
                if (v.isString()) {
                    constraints.add( asResource(v.getAsString().value(), proc) );
                } else {
                    throw new EpiException("Bad source configuration, type constraint can only be a string or array of strings");
                }
            }
            
        }
        return constraints;
    }
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:23,代码来源:RDFMapSource.java

示例3: processEnrichSpec

import org.apache.jena.atlas.json.JsonValue; //导入方法依赖的package包/类
protected void processEnrichSpec(JsonObject spec, ConverterProcess proc) {
    JsonValue enrichSpec = spec.get(JSONConstants.ENRICH);
    if (enrichSpec != null) {
        if (enrichSpec.isString()) {
            String enrichStr = enrichSpec.getAsString().value();
            if (enrichStr.equals("*")) {
                enrichDescribe = true;
            } else {
                enrich.add( asProperty(enrichStr, proc) );
            }
        } else if (enrichSpec.isArray()) {
            for (Iterator<JsonValue> i = enrichSpec.getAsArray().iterator(); i.hasNext();) {
                JsonValue v = i.next();
                if (v.isString()) {
                    enrich.add( asProperty(v.getAsString().value(), proc) );
                } else {
                    throw new EpiException("Bad source configuration, enrich can only be a string or array of strings");
                }
            }
        } else {
            throw new EpiException("Bad source configuration, enrich can only be a string or array of strings");
        }
    }
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:25,代码来源:RDFMapSource.java

示例4: getStrOrNull

import org.apache.jena.atlas.json.JsonValue; //导入方法依赖的package包/类
/** Access a field of a JSON object : return a string or null */ 
public static String getStrOrNull(JsonObject obj, String field) {
    JsonValue jv = obj.get(field);
    if ( jv == null )
        return null;
    if ( jv.isString() )
        return jv.getAsString().value();
    return null ;
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:10,代码来源:JSONX.java

示例5: getJsonString

import org.apache.jena.atlas.json.JsonValue; //导入方法依赖的package包/类
protected String getJsonString(String key) {
    JsonValue v = spec.get(key);
    if (v == null) {
        return null;
    } else if (v.isString()) {
        return v.getAsString().value();
    } else {
        throw new EpiException("Expected json property to be a string but found: " + v);
    }
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:11,代码来源:TemplateBase.java

示例6: getTemplateRef

import org.apache.jena.atlas.json.JsonValue; //导入方法依赖的package包/类
protected Template getTemplateRef(JsonValue ref, DataContext dc) {
    if (ref.isString()) {
        return new TemplateRef(ref.getAsString().value(), dc);
    } else if (ref.isObject()) {
        return TemplateFactory.templateFrom(ref.getAsObject(), dc);
    } else {
        throw new EpiException("Template must be specified as a name or an embedded object: " + ref);
    }
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:10,代码来源:TemplateBase.java

示例7: getTemplates

import org.apache.jena.atlas.json.JsonValue; //导入方法依赖的package包/类
protected List<Template> getTemplates(JsonValue tspec, DataContext dc) {
    List<Template> templates = new ArrayList<>();
    if (tspec != null) {
        if (tspec.isObject()) {
            templates.add( TemplateFactory.templateFrom(tspec.getAsObject(), dc) );
        } else if (tspec.isArray()) {
            for (Iterator<JsonValue> i = tspec.getAsArray().iterator(); i.hasNext();) {
                templates.add( TemplateFactory.templateFrom(i.next(), dc) );
            }
        } else if (tspec.isString()) {
            templates.add( new TemplateRef(tspec.getAsString().value(), dc) );
        }
    }
    return templates;
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:16,代码来源:TemplateBase.java

示例8: templateFrom

import org.apache.jena.atlas.json.JsonValue; //导入方法依赖的package包/类
public static Template templateFrom(JsonValue json, DataContext dc) {
    if (json.isArray()) {
        JsonArray templates = json.getAsArray();
        Template firstTemplate = null;
        for (Iterator<JsonValue> i = templates.iterator(); i.hasNext();) {
            JsonValue j = i.next();
            if (j.isObject()) {
                Template t = templateFrom(j.getAsObject(), dc);
                if (firstTemplate == null) {
                    firstTemplate = t;
                }
                if (t.getName() != null) {
                    dc.registerTemplate(t);
                }
            }
        }
        return firstTemplate;
    } else if (json.isObject()) {
        JsonObject jo = json.getAsObject();
        if (ResourceMapTemplate.isSpec(jo)) {
            return new ResourceMapTemplate(jo, dc);
        } else if (ParameterizedTemplate.isSpec(jo)) {
            return new ParameterizedTemplate(jo, dc);
        } else if (HierarchyTemplate.isSpec(jo)) {
            return new HierarchyTemplate(jo, dc);
        } else if (CompositeTemplate.isSpec(jo)) {
            return new CompositeTemplate(jo, dc);
        } else {
            return null;
        }
    } else if (json.isString()) {
        return new TemplateRef( json.getAsString().value(), dc);
    } else {
        
        throw new EpiException("Templates must be specified as a JSON object or an array of objects");
    }
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:38,代码来源:TemplateFactory.java

示例9: getBindingSet

import org.apache.jena.atlas.json.JsonValue; //导入方法依赖的package包/类
protected Map<String, Pattern> getBindingSet(JsonObject binding) {
    Map<String, Pattern> map = new HashMap<>();
    for (Entry<String, JsonValue> ent : binding.entrySet()) {
        JsonValue jv = ent.getValue();
        if (jv.isString()) {
            Pattern p = new Pattern(jv.getAsString().value(), dc);
            map.put(ent.getKey(), p);
        } else {
            throw new EpiException("Expected binding value to be a string but found: " + jv);
        }
    }
    return map;
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:14,代码来源:ParameterizedTemplate.java

示例10: getField

import org.apache.jena.atlas.json.JsonValue; //导入方法依赖的package包/类
protected String getField(String name) {
    JsonValue field = spec.get(name);
    if (field != null) {
        JsonValue value = spec.get(name);
        if (value.isString()) {
            return value.getAsString().value();
        }
        throw new EpiException("Expected a string value for " + name + " on " + spec);
    }
    return null;
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:12,代码来源:MapSourceBaseBase.java


注:本文中的org.apache.jena.atlas.json.JsonValue.isString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。