本文整理汇总了Java中com.hp.hpl.jena.rdf.model.StmtIterator.close方法的典型用法代码示例。如果您正苦于以下问题:Java StmtIterator.close方法的具体用法?Java StmtIterator.close怎么用?Java StmtIterator.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.rdf.model.StmtIterator
的用法示例。
在下文中一共展示了StmtIterator.close方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPropertyValues
import com.hp.hpl.jena.rdf.model.StmtIterator; //导入方法依赖的package包/类
<T> List<T> getPropertyValues(final Resource resource, final String property, final Function<Statement,Optional<T>> filter) {
Preconditions.checkState(this.model!=null);
final StmtIterator stmts = resource.listProperties(this.model.createProperty(property));
try {
final List<T> values=Lists.newArrayList();
while(stmts.hasNext()) {
final Statement st=stmts.nextStatement();
final Optional<T> result = filter.apply(st);
if(result.isPresent()) {
values.add(result.get());
}
}
return values;
} finally {
stmts.close();
}
}
示例2: execute
import com.hp.hpl.jena.rdf.model.StmtIterator; //导入方法依赖的package包/类
@Override
public Void execute() throws RuntimeException {
final StmtIterator iterator=
this.model.
listStatements(
null,
this.model.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
this.model.createProperty(this.propertyName));
try {
while(iterator.hasNext()) {
handler(iterator.next());
}
return null;
} finally {
iterator.close();
}
}
示例3: printIndividual
import com.hp.hpl.jena.rdf.model.StmtIterator; //导入方法依赖的package包/类
protected static String printIndividual(Individual individual) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Individual: " + individual.getLocalName() + "\n");
StmtIterator properties = individual.listProperties();
while (properties.hasNext()) {
Statement s = properties.next();
stringBuilder.append(" " + s.getPredicate().getLocalName() + " : " + s.getObject().toString() + "\n");
}
properties.close();
stringBuilder.append("\n");
stringBuilder.append(StringUtils.repeat("-", 70));
return stringBuilder.toString();
}
示例4: buildMappings
import com.hp.hpl.jena.rdf.model.StmtIterator; //导入方法依赖的package包/类
private void buildMappings(Model model) throws MalformedURLException {
mappings = new HashMap();
Property mapsTo = model.createProperty(RTM_MAPSTO);
StmtIterator it = model.listStatements(null, mapsTo, (RDFNode) null);
while (it.hasNext()) {
Statement stmt = (Statement) it.next();
StatementHandler mapper = getMapper(stmt.getSubject(), stmt.getObject(), model);
mappings.put(stmt.getSubject().getURI(), mapper);
}
it.close();
}
示例5: fillCounts
import com.hp.hpl.jena.rdf.model.StmtIterator; //导入方法依赖的package包/类
protected void fillCounts(StmtIterator iter, Map<Property,Integer> counts)
{
while ( iter.hasNext() )
{
Property p = iter.next().getPredicate();
Integer i = counts.get(p);
counts.put(p, i == null ? 1 : i + 1);
}
iter.close();
}
示例6: fillType
import com.hp.hpl.jena.rdf.model.StmtIterator; //导入方法依赖的package包/类
private void fillType(Resource obj)
{
Property type = obj.getModel().getProperty("rdf", "type");
StmtIterator iter = obj.listProperties(type);
try {
while ( iter.hasNext() )
{
_typeStat.newType(iter.next().getSubject());
}
}
finally {
iter.close();
}
}
示例7: printRows
import com.hp.hpl.jena.rdf.model.StmtIterator; //导入方法依赖的package包/类
static void printRows(StmtIterator rows) throws Exception {
while (rows.hasNext()) {
System.out.println(rows.next());
}
rows.close();
}