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


Java Statement.getString方法代码示例

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


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

示例1: getStringProperty

import org.apache.jena.rdf.model.Statement; //导入方法依赖的package包/类
public static String getStringProperty(Resource subject, Property predicate) {
	Statement s = subject.getProperty(predicate);
	if(s != null && s.getObject().isLiteral()) {
		return s.getString();
	}
	else {
		return null;
	}
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:10,代码来源:JenaUtil.java

示例2: toString

import org.apache.jena.rdf.model.Statement; //导入方法依赖的package包/类
@Override
   public String toString() {
	String label = getLabel();
	if(label == null) {
		Statement s = getResource().getProperty(SH.construct);
		if(s != null && s.getObject().isLiteral()) {
			label = "\n" + s.getString();
		}
		else {
			label = "(Missing SPARQL query)";
		}
	}
	return getLabelStart("SPARQL") + label;
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:15,代码来源:SPARQLRule.java

示例3: toString

import org.apache.jena.rdf.model.Statement; //导入方法依赖的package包/类
@Override
   public String toString() {
	String label = getLabel();
	if(label == null) {
		Statement s = getResource().getProperty(SH.jsFunctionName);
		if(s != null && s.getObject().isLiteral()) {
			label = s.getString();
		}
		else {
			label = "(Missing JavaScript function name)";
		}
	}
	return getLabelStart("JavaScript") + label;
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:15,代码来源:JSRule.java

示例4: getLabel

import org.apache.jena.rdf.model.Statement; //导入方法依赖的package包/类
public String getLabel() {
	Statement s = resource.getProperty(RDFS.label);
	if(s != null && s.getObject().isLiteral()) {
		return s.getString();
	}
	else {
		return null;
	}
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:10,代码来源:Rule.java

示例5: executeLibraries

import org.apache.jena.rdf.model.Statement; //导入方法依赖的package包/类
@Override
   public void executeLibraries(Resource e) throws Exception {
	for(Resource library : JenaUtil.getResourceProperties(e, SH.jsLibrary)) {
		if(!visitedLibraries.contains(library)) {
			visitedLibraries.add(library);
			executeLibraries(library);
		}
	}
	for(Statement s : e.listProperties(SH.jsLibraryURL).toList()) {
		if(s.getObject().isLiteral()) {
			String url = s.getString();
			executeScriptFromURL(url);
		}
	}
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:16,代码来源:NashornScriptEngine.java

示例6: getPath

import org.apache.jena.rdf.model.Statement; //导入方法依赖的package包/类
@Override
public UriTemplate getPath()
{
    Statement path = getProperty(LDT.path);
    if (path != null) return new UriTemplate(path.getString());
    
    return null;
}
 
开发者ID:AtomGraph,项目名称:Processor,代码行数:9,代码来源:TemplateImpl.java

示例7: getParameterizedSparqlString

import org.apache.jena.rdf.model.Statement; //导入方法依赖的package包/类
public ParameterizedSparqlString getParameterizedSparqlString(org.spinrdf.model.Command command, URI base)
   {
if (command == null) throw new IllegalArgumentException("Command cannot be null");
if (base == null) throw new IllegalArgumentException("Base URI cannot be null");

       Statement textStmt = command.getRequiredProperty(SP.text);
       if (textStmt == null || !textStmt.getObject().isLiteral())
       {
           if (log.isErrorEnabled()) log.error("SPARQL string not defined for Command '{}' (sp:text missing or not a string)", command);
           throw new OntologyException("SPARQL string not defined for Command '" + command + "'");
       }

       return new ParameterizedSparqlString(textStmt.getString(), null, base.toString());
   }
 
开发者ID:AtomGraph,项目名称:Processor,代码行数:15,代码来源:TemplateImpl.java

示例8: isValid

import org.apache.jena.rdf.model.Statement; //导入方法依赖的package包/类
/** check validity of simple content */

public boolean isValid(Resource resource, Context ctx) {
	Model model = ctx.getModel();
	Property prop = model.createProperty(createURI(model,ctx));
	Statement stmt = resource.getProperty(prop);
	String value = stmt!=null?stmt.getString():null;
	attribute def = getDefinition(model,ctx);
	XMLBean t = def.get_type(ctx);
	if (t instanceof simpleType) return ((simpleType)t).isValid(value, ctx);
	return true;
}
 
开发者ID:stevebattle,项目名称:Gloze,代码行数:13,代码来源:attribute.java

示例9: toXMLValue

import org.apache.jena.rdf.model.Statement; //导入方法依赖的package包/类
public String toXMLValue(Element elem, RDFNode rdf, String type, Context ctx) {
	String v = null;
	if (rdf instanceof Resource) {
		Resource r = (Resource) rdf;
		
		if (type!=null && (type.equals(XSD_URI+"#QName") || type.equals(XSD_URI+"#NOTATION")) && !r.isAnon()) 
			v = r.getURI();
		else if (type!=null && type.equals(XSD_URI+"#ID") && !r.isAnon())
			v = r.getLocalName();
		else if (type!=null && type.equals(XSD.IDREF.getURI()) && !r.isAnon()
				&& XMLBean.equalNS(r.getNameSpace(),ctx.getBaseMap().toString())) 
			v = r.getLocalName();
		else if (type!=null && type.equals(XSD_URI+"#IDREFS")) {
			v = listToString(r,elem,XSD.IDREF.getURI(),ctx);
		}
		else if (type!=null && type.equals(XSD_URI+"#NMTOKENS")) {
			v = listToString(r,elem,XSD.NMTOKEN.getURI(),ctx);
		}
		else if (r.hasProperty(RDF.value)) {
			Statement stmt = r.getProperty(RDF.value);
			if (type!=null && type.equals(XSD_URI+"#IDREF"))
				v = stmt.getResource().getLocalName();
			else if (stmt.getObject() instanceof Literal) v = stmt.getString();		
		}			
		else if (r.canAs(RDFList.class)) {
			v = listToString(r,elem,null,ctx);
		}
	}
	else if (rdf instanceof Literal) {
		v = ((Literal) rdf).getString();
	}
	
	if (type!=null && type.equals(XSD_URI+"#QName"))
		v = contractQName(v, elem, ctx.getModel(), ctx.getBaseMap());
	
	else if (type!=null && (type.equals(XSD_URI+"#anyURI") || type.equals(XSD_URI+"#NOTATION")))
		try {
			v = relativize(ctx.getBaseMap(),new URI(v)).toString();
		} catch (Exception e) {
			// non-fatal
		}

	return v;
}
 
开发者ID:stevebattle,项目名称:Gloze,代码行数:45,代码来源:schema.java


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