com.hp.hpl.jena.graph.Graph.add()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中com.hp.hpl.jena.graph.Graph.add()方法的一些代码示例,展示了Graph.add()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.add()方法的具体详情如下:
包路径:com.hp.hpl.jena.graph.Graph
类名称:Graph
方法名:add

Graph.add介绍

[英]Add the triple t (if possible) to the set belonging to this graph
[中]将三重t(如果可能)添加到属于此图的集合中

代码示例

代码示例来源:origin: com.hp.hpl.jena/arq

public void send(Triple triple)
  {
    graph.add(triple) ;
  }
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static void addAll(Graph g, Iterator<Triple> iter)
{
  while(iter.hasNext())
    g.add(iter.next()) ;
  Iter.close(iter) ;
}

代码示例来源:origin: com.github.ansell.pellet/pellet-common

protected void addClasses(Collection<ATermAppl> classes) {
  for (ATermAppl c : classes) {
    Node n = m_Names.get(c);
    m_Facts.add(Triple.create(n, PRED_SUB, n));
    m_Facts.add(Triple.create(n, PRED_SUB, TOP));
  }
}

代码示例来源:origin: com.hp.hpl.jena/arq

@Override
public void add(Quad quad)
{ 
  if (  isDefaultGraph(quad) )
    graph.add(quad.asTriple()) ;
  else
    throw new UnsupportedOperationException("DatasetGraphOne.add/named graph") ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

@Override
public void add(Triple t)
{
  base.add(t) ;
  getEventManager().notifyAddTriple(this, t) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

@Override
public void statement(AResource subj, AResource pred, ALiteral lit)
{
  try
  {
    Triple t = JenaReader.convert(subj, pred, lit) ;
    graph.add(t) ;
  } catch (JenaException e)
  {
    errorHandler.error(e) ;
  }
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.remote

@Override public void add(Triple[] arg0) {
  Graph g = GraphFactory.createPlainGraph();
  for (int i = 0; i < arg0.length; i++) {
    g.add(arg0[i]);
  }
  add(g);
}

代码示例来源:origin: org.apache.clerezza/rdf.jena.storage

@Override
public boolean performAdd(Triple triple) {
  if (contains(triple)) {
    return false;
  }
  jenaGraph.add(tria2JenaUtil.convertTriple(triple, true));
  return true;
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.remote

@Override public void add(List<Triple> arg0) {
  Graph g = GraphFactory.createPlainGraph();
  for (Triple t : arg0) {
    g.add(t);
  }
  add(g);
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

@Override
public void statement(AResource subj, AResource pred, AResource obj)
{
  try
  {
    Triple t = JenaReader.convert(subj, pred, obj) ;
    graph.add(t) ;
  } catch (JenaException e)
  {
    errorHandler.error(e) ;
  }
}

代码示例来源: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: com.hp.hpl.jena/arq

@Override
public void add(Quad quad)
{
  Graph g = fetchGraph(quad.getGraph()) ;
  if ( g == null )
    System.err.println("null graph") ;
  
  g.add(quad.asTriple()) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Add one triple to the data graph, run any rules triggered by
 * the new data item, recursively adding any generated triples.
 */
@Override
public synchronized void performAdd(Triple t) {
  this.requirePrepared();
  fdata.getGraph().add(t);
  engine.add(t);
}

代码示例来源:origin: com.hp.hpl.jena/arq

public void send(Quad quad)
{
  if ( quad.isTriple() )
    dataset.getDefaultGraph().add(quad.asTriple()) ;
  else
    dataset.add(quad) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
public void send(Quad quad)
{
  if ( quad.isTriple() )
    dataset.getDefaultGraph().add(quad.asTriple()) ;
  else
    dataset.add(quad) ;
}

代码示例来源: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.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
public void add(Quad quad)
{
  Graph g = fetchGraph(quad.getGraph()) ;
  if ( g == null )
    throw new JenaException("No such graph: "+quad.getGraph()) ;
  g.add(quad.asTriple()) ;
}

代码示例来源:origin: com.hp.hpl.jena/tdb

private static void addGraph(Dataset dataset, int i)
{
  // Not a very interesting model
  Model m = dataset.getNamedModel("graph:"+i) ;
  Triple t1 = SSE.parseTriple("(<uri:x> <uri:p> "+i+")") ;
  Triple t2 = SSE.parseTriple("(<uri:y> <uri:q> 'ABC')") ; 
  m.getGraph().add(t1) ;
  m.getGraph().add(t2) ;
}

代码示例来源:origin: com.hp.hpl.jena/tdb

@Test public void update4()
{
  Dataset ds = TDBFactory.createDataset() ;
  
  ds.asDatasetGraph().getDefaultGraph().add(t1) ;
  ds.getNamedModel(graphName).getGraph().add(t1) ;
  
  Model m = ds.getNamedModel(graphName) ;
  m.removeAll() ;
  assertEquals(0, m.size()) ;
  
  // But still in the other graph
  assertTrue(ds.getDefaultModel().getGraph().contains(t1)) ;
}

代码示例来源:origin: com.hp.hpl.jena/tdb

@Test public void update3()
{
  Dataset ds = TDBFactory.createDataset() ;
  
  ds.asDatasetGraph().getDefaultGraph().add(t1) ;
  ds.getNamedModel(graphName).getGraph().add(t1) ;
  
  Model m = ds.getDefaultModel() ;
  m.removeAll() ;
  assertEquals(0, m.size()) ;
  
  // But still in the other graph
  assertTrue(ds.getNamedModel(graphName).getGraph().contains(t1)) ;
}

相关文章