本文整理匯總了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;
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
}
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}