本文整理了Java中org.openrdf.model.Graph.getStatements()
方法的一些代码示例,展示了Graph.getStatements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getStatements()
方法的具体详情如下:
包路径:org.openrdf.model.Graph
类名称:Graph
方法名:getStatements
[英]Retrieves all statements in the graph as an iterator
[中]以迭代器的形式检索图中的所有语句
代码示例来源:origin: org.openrdf/openrdf-model
public int remove(Graph graph) {
return remove(graph.getStatements());
}
代码示例来源:origin: org.openrdf/sesame
/**
* Generates a Turtle document from the supplied graph.
**/
private String _graph2TurtleDoc(Graph graph)
throws IOException
{
StringWriter stringWriter = new StringWriter(8192);
TurtleWriter turtleWriter = new TurtleWriter(stringWriter);
turtleWriter.startDocument();
StatementIterator statIter = graph.getStatements();
while (statIter.hasNext()) {
Statement st = statIter.next();
turtleWriter.writeStatement(st.getSubject(), st.getPredicate(), st.getObject());
}
statIter.close();
turtleWriter.endDocument();
return stringWriter.toString();
}
代码示例来源:origin: org.openrdf/openrdf-model
StatementIterator iter = graph.getStatements();
代码示例来源:origin: org.openrdf/sesame
StatementIterator iter = graph.getStatements();
代码示例来源:origin: org.openrdf/sesame
StatementIterator sti = graph.getStatements(null,resRdfType,resUser);
while ( sti.hasNext() ) {
Resource resCUser = sti.next().getSubject();
int id = Integer.parseInt(
graph.getStatements(resCUser,proId,null).next().getObject().toString());
User user = new UserImpl(id,"","","");
StatementIterator rui = graph.getStatements(resCUser,proHasRule,null);
Set rulzSet = new HashSet();
while (rui.hasNext()){
if ( null == rule ) {
rule = new RuleImpl(
Integer.parseInt(graph.getStatements(rul,proId,null)
.next().getObject().toString())
,"","");
= graph.getStatements(resCUser,proHasRole,null);
Set rolzSet = new HashSet();
while (roi.hasNext()){
if ( null == role ) {
role = new RoleImpl(
Integer.parseInt(graph.getStatements(rol,proId,null).next().
getObject().toString())
,"","");
StatementIterator sti = graph.getStatements(null,resRdfType,resRole);
while ( sti.hasNext() ) {
代码示例来源:origin: org.openrdf/sesame
public void removeGraph(Graph graph)
throws IOException, AccessDeniedException
{
_ensureWriteAccess();
// Write access given, therefore Sail is an RdfRepository.
RdfRepository thisRep = (RdfRepository)_rdfSource;
StatementIterator iter = graph.getStatements();
try {
thisRep.startTransaction();
while (iter.hasNext()) {
Statement st = iter.next();
thisRep.removeStatements(st.getSubject(), st.getPredicate(),
st.getObject());
}
}
catch (SailUpdateException e) {
// FIXME is this a correct conversion?
throw new IOException(e.getMessage());
}
finally {
thisRep.commitTransaction();
iter.close();
}
}
代码示例来源:origin: org.openrdf/sesame
public void mergeGraph(Graph graph)
throws IOException, AccessDeniedException
{
_ensureWriteAccess();
// Write access given, therefore Sail is an RdfRepository.
RdfRepository thisRep = (RdfRepository)_rdfSource;
StatementIterator iter = graph.getStatements();
try {
thisRep.startTransaction();
while (iter.hasNext()) {
Statement st = iter.next();
Resource subject = st.getSubject();
URI predicate = st.getPredicate();
Value object = st.getObject();
thisRep.addStatement(subject, predicate, object);
}
}
catch (SailUpdateException e) {
// FIXME is this a correct conversion?
throw new IOException(e.getMessage());
}
finally {
thisRep.commitTransaction();
iter.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!