本文整理汇总了Java中org.openrdf.model.Graph.getStatements方法的典型用法代码示例。如果您正苦于以下问题:Java Graph.getStatements方法的具体用法?Java Graph.getStatements怎么用?Java Graph.getStatements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.model.Graph
的用法示例。
在下文中一共展示了Graph.getStatements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import org.openrdf.model.Graph; //导入方法依赖的package包/类
public void test() throws Exception {
InputStreamReader reader = new InputStreamReader(ClassLoader
.getSystemResourceAsStream("test/rdfs/reasoner/io/test.rdfs"));
Map<String, Graph> result = parser.parse(reader, "");
Entry<String, Graph> entry = result.entrySet().iterator().next();
Graph graph = entry.getValue();
StatementIterator it = graph.getStatements();
int size = 0;
while (it.hasNext()) {
Statement s = (Statement) it.next();
s.toString();
// System.out.println(s.toString());
size++;
}
assertEquals(size, 21);
}
示例2: convertOntology
import org.openrdf.model.Graph; //导入方法依赖的package包/类
protected Set<Rule> convertOntology(Graph ontology, String defaultNS)
throws NonStandardRDFSUseException {
Set<Rule> rules = new HashSet<Rule>();
ruleSet = new HashSet<Rule>();
RDFS2DatalogTransformer rdfs2datalog = new RDFS2DatalogTransformer(defaultNS);
StatementIterator it = ontology.getStatements();
while (it.hasNext()) {
Statement statement = it.next();
Rule rule = rdfs2datalog.transform(statement);
rules.add(rule);
ruleSet.add(rule);
}
return rules;
}
示例3: checkForNonStandardRDFSUse
import org.openrdf.model.Graph; //导入方法依赖的package包/类
/**
* Checks for a non-standard use of the RDFS vocabulary in the given RDF
* graph. Non-standard use of the RDFS vocabulary corresponds to using the
* vocabulary in locations where it has not been intended
* (e.g. <type, subPropertyOf, a>, an occurrence of
* <tt>Class<tt> in an RDFS graph, ...).
*
* @param graph - the RDF graph to check for non-standard use of RDFS vocabulary
* @return true if the graph includes non-standard use of the RDFS
* vocabulary and false otherwise
*/
private boolean checkForNonStandardRDFSUse(Graph graph) {
StatementIterator it = graph.getStatements();
while (it.hasNext()) {
checkForNonStandardRDFSUse(it.next());
}
if (usages.size() > 0) {
return true;
}
else {
return false;
}
}