本文整理了Java中com.hp.hpl.jena.graph.Graph
类的一些代码示例,展示了Graph
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph
类的具体详情如下:
包路径:com.hp.hpl.jena.graph.Graph
类名称:Graph
[英]The interface to be satisfied by implementations maintaining collections of RDF triples. The core interface is small (add, delete, find, contains) and is augmented by additional classes to handle more complicated matters such as reification, query handling, bulk update, event management, and transaction handling.
For add(Triple)
see GraphAdd.
[中]维护RDF三元组集合的实现需要满足的接口。核心接口很小(添加、删除、查找、包含),并通过附加类进行扩展,以处理更复杂的事务,如物化、查询处理、批量更新、事件管理和事务处理。
有关add(Triple)
的信息,请参见GraphAdd。
代码示例来源:origin: com.hp.hpl.jena/arq
public void send(Triple triple)
{
graph.add(triple) ;
}
}
代码示例来源:origin: org.fcrepo/fcrepo-kernel
/**
* This method will return null until the source iterator is exhausted.
*
* @return The elements that turned out not to be common to the two inputs.
*/
public Iterator<Triple> notCommon() {
return source.hasNext() ? null : notCommon.find(ANY, ANY, ANY);
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* Remove the triple, ie, remove it from the adds, add it to the removals.
*/
@Override
public void performDelete(Triple t)
{
L.delete(t) ;
if (base.contains(t))
R.add(t) ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
Add a triple to the difference: add it to the left operand, and remove it from the
right operand.
*/
@Override public void performAdd( Triple t )
{
L.add( t );
R.delete( t );
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
private void clearGraph(Graph graph) {
if ( !graph.isEmpty() )
graph.clear() ;
}
代码示例来源:origin: com.hp.hpl.jena/tdb
static private void addAll(Graph srcGraph, Graph dstGraph)
{
Iterator<Triple> triples = srcGraph.find(Node.ANY, Node.ANY, Node.ANY) ;
for ( Triple t : Iter.iter(triples) )
dstGraph.add(t) ;
}
代码示例来源:origin: org.appdapter/org.appdapter.lib.remote
public static void removeAll(Graph g, Node s, Node p, Node o) {
ExtendedIterator<Triple> it = g.find(s, p, o);
try {
while (it.hasNext()) {
Triple t = it.next();
g.delete(t);
it.remove();
}
} finally {
it.close();
}
}
代码示例来源:origin: openimaj/openimaj
@Override
public void write(Kryo kryo, Output output, Graph object) {
output.writeInt(object.size());
final Iterator<Triple> it = object.find(null, null, null);
while (it.hasNext()) {
final Triple next = it.next();
kryo.writeClassAndObject(output, next);
}
}
代码示例来源:origin: com.hp.hpl.jena/arq
public boolean handledRemove(Triple triple)
{
graph.delete(triple) ;
return true ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
public int size()
{
return graph.size() ;
}
代码示例来源:origin: com.hp.hpl.jena/arq
public static boolean isContainer(Graph graph, Node container, Node containerType)
{
// if ( container.isLiteral() )
// return false ;
if ( containerType == null )
return isContainer(graph, container, BAG) ||
isContainer(graph, container, ALT) ||
isContainer(graph, container, SEQ) ;
return graph.contains(container, RDFtype, containerType) ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
public PrefixMapping getPrefixMapping()
{
return graph.getPrefixMapping() ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
@Override
public void close()
{
L.close();
R.close();
this.closed = true;
}
代码示例来源:origin: com.hp.hpl.jena/tdb
@Test public void load_dataset_01()
{
DatasetGraphTDB dsg = TDBFactory.createDatasetGraph() ;
TDBLoader.load(dsg, DIR+"data-1.nq", false) ;
assertTrue(dsg.getDefaultGraph().isEmpty()) ;
assertEquals(1, dsg.getGraph(g).size()) ;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
public boolean isEmpty()
{
return graph.isEmpty() ;
}
代码示例来源:origin: com.hp.hpl.jena/tdb
public void clearGraph()
{
if ( graph != null )
{
Iterator<Triple> iter = Iter.convert(graph.find(Node.ANY, Node.ANY, Node.ANY)) ;
List<Triple> triples = Iter.toList(iter) ;
for ( Triple t : triples )
graph.delete(t) ;
}
}
代码示例来源:origin: org.openimaj.storm/core-storm
@Override
public void write(Kryo kryo, Output output, Graph object) {
output.writeInt(object.size());
final Iterator<Triple> it = object.find(null, null, null);
while (it.hasNext()) {
final Triple next = it.next();
kryo.writeClassAndObject(output, next);
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
Remove a triple from the difference: remove it from the left operand. [It could
be added to the right operand instead, but somehow that feels less satisfactory.]
*/
@Override public void performDelete( Triple t )
{ L.delete( t ); }
代码示例来源:origin: com.hp.hpl.jena/arq
ReorderStatsHandler(Graph graph, GraphStatisticsHandler stats)
{
this.stats = stats ;
N = graph.size() ;
// Note: when these are too badly wrong, the app can supply a statistics file.
TERM_S = 10 ; // Wild guess: "An average subject has 10 properties".
TERM_P = N/10 ; // Wild guess: "An average vocabulary has 10 properties"
TERM_O = 20 ; // Wild guess: "An average object is in 20 triples".
TERM_TYPE = N/10 ; // Wild guess: "An average class has 1/10 of the resources."
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
@Override
public boolean doCheck( Node n, EnhGraph g ) {
return g.asGraph().contains( n, RDF.type.asNode(), OWL.AllDifferent.asNode() );
}
}
内容来源于网络,如有侵权,请联系作者删除!