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