org.openrdf.model.Graph.add()方法的使用及代码示例

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

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

Graph.add介绍

[英]Adds all statements in the Collection to the graph. If the supplied collection contains any blank nodes that are shared with this graph, these will be joined.
[中]将集合中的所有语句添加到图形中。如果提供的集合包含与此图共享的任何空白节点,则这些节点将被联接。

代码示例

代码示例来源:origin: blazegraph/database

/**
 * Describe the supported Query Languages
 */
protected void describeLanguages() {
  g.add(aService, SD.supportedLanguage, SD.SPARQL10Query);
  
  g.add(aService, SD.supportedLanguage, SD.SPARQL11Query);
  g.add(aService, SD.supportedLanguage, SD.SPARQL11Update);
}

代码示例来源:origin: org.openrdf.sesame/sesame-query

@Override
public void handleStatement(Statement st)
  throws RDFHandlerException
{
  graph.add(st);
}

代码示例来源:origin: org.openrdf.sesame/sesame-query

@Override
public void handleStatement(Statement st)
  throws RDFHandlerException
{
  graph.add(st);
}

代码示例来源:origin: com.blazegraph/bigdata-core

/**
 * Describe the supported Query Languages
 */
protected void describeLanguages() {
  g.add(aService, SD.supportedLanguage, SD.SPARQL10Query);
  
  g.add(aService, SD.supportedLanguage, SD.SPARQL11Query);
  g.add(aService, SD.supportedLanguage, SD.SPARQL11Update);
}

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rdf

public void addType( String subject, URI type )
{
  URI subjectUri = valueFactory.createURI( subject );
  Statement statement = valueFactory.createStatement( subjectUri, Rdfs.TYPE, type );
  graph.add( statement );
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-sparql

@Override
public Resource export(Graph graph) {
  Resource implNode = super.export(graph);
  ValueFactory vf = graph.getValueFactory();
  if (url != null) {
    graph.add(implNode, ENDPOINT, vf.createURI(url));
  }
  for (String space : subjects) {
    graph.add(implNode, SUBJECT_SPACE, vf.createURI(space));
  }
  return implNode;
}

代码示例来源:origin: blazegraph/database

/**
 * Describe the service end point(s).
 * 
 * @see #endpoint
 */
protected void describeServiceEndpoints() {
  for (String uri : serviceURI) {
    g.add(aService, SD.endpoint, g.getValueFactory().createURI(uri));
  }
}

代码示例来源:origin: com.blazegraph/bigdata-core

/**
 * Describe the service end point(s).
 * 
 * @see #endpoint
 */
protected void describeServiceEndpoints() {
  for (String uri : serviceURI) {
    g.add(aService, SD.endpoint, g.getValueFactory().createURI(uri));
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-rio-api

@Override
public void handleStatement(Statement st)
  throws RDFHandlerException
{
  synchronized (bufferLock) {
    bufferedStatements.add(st);
    contexts.add(st.getContext());
    if (bufferedStatements.size() >= this.bufferSize) {
      processBuffer();
    }
  }
}

代码示例来源:origin: blazegraph/database

@Override
public Resource export(Graph graph)
{
  Resource implNode = super.export(graph);
  if (propertiesFile != null) {
    graph.add(implNode, BigdataConfigSchema.PROPERTIES, 
        graph.getValueFactory().createLiteral(propertiesFile));
  }
  return implNode;
}

代码示例来源:origin: blazegraph/database

@Override
public Resource export(Graph graph)
{
  Resource implNode = super.export(graph);
  if (propertiesFile != null) {
    graph.add(implNode, BigdataConfigSchema.PROPERTIES, 
        graph.getValueFactory().createLiteral(propertiesFile));
  }
  return implNode;
}

代码示例来源:origin: apache/attic-polygene-java

public void addName( String subject, String name )
{
  Value nameValue = valueFactory.createLiteral( name );
  URI subjectUri = valueFactory.createURI( subject );
  graph.add( valueFactory.createStatement( subjectUri, Rdfs.LABEL, nameValue ) );
}

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rdf

public void addRelationship( String subject, URI relationship, String object )
{
  URI subjectUri = valueFactory.createURI( subject );
  URI objectUri = valueFactory.createURI( object );
  Statement statement = valueFactory.createStatement( subjectUri, relationship, objectUri );
  graph.add( statement );
}

代码示例来源:origin: com.blazegraph/bigdata-core

@Override
public Resource export(Graph graph)
{
  Resource implNode = super.export(graph);
  if (propertiesFile != null) {
    graph.add(implNode, BigdataConfigSchema.PROPERTIES, 
        graph.getValueFactory().createLiteral(propertiesFile));
  }
  return implNode;
}

代码示例来源:origin: com.blazegraph/bigdata-core

@Override
public Resource export(Graph graph)
{
  Resource implNode = super.export(graph);
  if (propertiesFile != null) {
    graph.add(implNode, BigdataConfigSchema.PROPERTIES, 
        graph.getValueFactory().createLiteral(propertiesFile));
  }
  return implNode;
}

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rdf

public void addStatement( String subject, URI predicate, String literal )
{
  Literal object = valueFactory.createLiteral( literal );
  URI subjectUri = valueFactory.createURI( subject );
  Statement statement = valueFactory.createStatement( subjectUri, predicate, object );
  graph.add( statement );
}

代码示例来源:origin: blazegraph/database

@Override
public <E extends Exception> void remove(
    final Iteration<? extends Statement, E> stmts, final Resource... c)
    throws RepositoryException, E {
  final Graph g = new LinkedHashModel();
 while (stmts.hasNext()) {
   g.add(stmts.next());
 }

  remove(g, c);
}

代码示例来源:origin: blazegraph/database

@Override
public <E extends Exception> void add(
    final Iteration<? extends Statement, E> stmts, final Resource... c)
    throws RepositoryException, E {
  
  final Graph g = new LinkedHashModel();
  while (stmts.hasNext()) {
  
    g.add(stmts.next());
      }
  
  add(g, c);
  
}

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rdf

private void serializeMixinTypes( final EntityDescriptor entityDescriptor,
                 final Graph graph,
                 final URI entityTypeUri )
{
  ValueFactory values = graph.getValueFactory();
  // Mixin types
  for( Class<?> mixinType : entityDescriptor.mixinTypes() )
  {
    graph.add( entityTypeUri, Rdfs.SUB_CLASS_OF, values.createURI( Classes.toURI( mixinType ) ) );
  }
}

代码示例来源:origin: blazegraph/database

protected Graph genNTRIPLES2(final int ntriples)
    throws RDFHandlerException {
  final Graph g = new LinkedHashModel();
  final ValueFactory f = new ValueFactoryImpl();
  final URI s = f.createURI("http://www.bigdata.org/b");
  final URI rdfType = f
      .createURI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
  for (int i = 0; i < ntriples; i++) {
    final URI o = f.createURI("http://www.bigdata.org/c#" + i);
    g.add(s, rdfType, o);
  }
  
  return g;
}

相关文章