當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。