本文整理汇总了Java中org.openrdf.model.Statement.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Statement.toString方法的具体用法?Java Statement.toString怎么用?Java Statement.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.model.Statement
的用法示例。
在下文中一共展示了Statement.toString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accept
import org.openrdf.model.Statement; //导入方法依赖的package包/类
@Override
public boolean accept(Statement stmt) {
lastCause="No error";
if(unacceptableProperties != null && unacceptableProperties.length > 0){
String predicate = stmt.getPredicate().stringValue();
for(String s : unacceptableProperties){
if(s.equals(predicate)){
lastCause = "Property "+predicate+ " of statement "+stmt.toString()+" present in black list.";
return false;
}
}
return true;
}
else{
return true;
}
}
示例2: accept
import org.openrdf.model.Statement; //导入方法依赖的package包/类
@Override
public boolean accept(Statement stmt) {
lastCause="No error";
if(acceptableProperties != null && acceptableProperties.length > 0){
String predicate = stmt.getPredicate().stringValue();
for(String s : acceptableProperties){
if(s.equals(predicate)){
return true;
}
}
lastCause = "Property "+predicate+ " of statement "+stmt.toString()+" not in white list.";
return false;
}
else{
return true;
}
}
示例3: getGeometry
import org.openrdf.model.Statement; //导入方法依赖的package包/类
/**
* Parse GML/wkt literal to Geometry
*
* @param statement
* @return
* @throws ParseException
* @throws ParserConfigurationException
* @throws SAXException
* @throws IOException
*/
public static Geometry getGeometry(final Statement statement, GmlToGeometryParser gmlToGeometryParser) throws ParseException {
// handle GML or WKT
final Literal lit = getLiteral(statement);
if (GeoConstants.XMLSCHEMA_OGC_WKT.equals(lit.getDatatype())) {
final String wkt = lit.getLabel().toString();
return (new WKTReader()).read(wkt);
} else if (GeoConstants.XMLSCHEMA_OGC_GML.equals(lit.getDatatype())) {
final String gml = lit.getLabel().toString();
try {
return getGeometryGml(gml, gmlToGeometryParser);
} catch (IOException | SAXException | ParserConfigurationException e) {
throw new ParseException(e);
}
} else {
throw new ParseException("Literal is unknown geo type, expecting WKT or GML: " + statement.toString());
}
}
示例4: getLiteral
import org.openrdf.model.Statement; //导入方法依赖的package包/类
public static Literal getLiteral(final Statement statement) throws ParseException {
final org.openrdf.model.Value v = statement.getObject();
if (!(v instanceof Literal)) {
throw new ParseException("Statement does not contain Literal: " + statement.toString());
}
final Literal lit = (Literal) v;
return lit;
}
示例5: rollingCacheContains
import org.openrdf.model.Statement; //导入方法依赖的package包/类
/**
* keeps track of the most recent 1000 statements and returns true if the input statement is in
* the cache
*
* @param stmt
* @return
*/
private boolean rollingCacheContains(Statement stmt) {
String stmtStr = stmt.toString();
if (rollingCacheSet.contains(stmtStr)) {
return true;
}
int currentSize = rollingCacheList.size();
if (currentSize >= ROLLING_CACHE_MAX_SIZE) {
String removed = rollingCacheList.removeLast();
rollingCacheSet.remove(removed);
}
rollingCacheSet.add(stmtStr);
rollingCacheList.addFirst(stmtStr);
return false;
}