org.eclipse.rdf4j.query.Dataset.getDefaultGraphs()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(94)

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

Dataset.getDefaultGraphs介绍

[英]Gets the default graph URIs of this dataset. An empty default graph set and a non-empty named graph set indicates that the default graph is an empty graph. However, if both the default graph set and the named graph set are empty, that indicates that the store's default behaviour should be used.
[中]获取此数据集的默认图形URI。空的默认图集和非空的命名图集表示默认图是空图。但是,如果默认图形集和命名图形集都为空,则表示应使用存储的默认行为。

代码示例

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

public Set<IRI> getDefaultGraphs() {
  Set<IRI> set = primary.getDefaultGraphs();
  if (set == null || set.isEmpty())
    return fallback.getDefaultGraphs();
  return set;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-query

public Set<IRI> getDefaultGraphs() {
  Set<IRI> set = primary.getDefaultGraphs();
  if (set == null || set.isEmpty())
    return fallback.getDefaultGraphs();
  return set;
}

代码示例来源:origin: eclipse/rdf4j

@Override
public Set<IRI> getDefaultGraphs() {
  Set<IRI> set = primary.getDefaultGraphs();
  if (set == null || set.isEmpty())
    return fallback.getDefaultGraphs();
  return set;
}

代码示例来源:origin: joshsh/sesametools

public boolean readPermitted(final Resource context) throws SailException {
  return context instanceof IRI && readableSet.getDefaultGraphs().contains(context);
}

代码示例来源:origin: joshsh/sesametools

public boolean writePermitted(final Resource context) throws SailException {
  return context instanceof IRI && writableSet.getDefaultGraphs().contains(context);
}

代码示例来源:origin: joshsh/sesametools

public void addReadableGraph(final IRI g) {
  readableSet.getDefaultGraphs().add(g);
}

代码示例来源:origin: joshsh/sesametools

public void addWritableGraph(final IRI g) {
  writableSet.getDefaultGraphs().add(g);
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

protected List<NameValuePair> getQueryMethodParameters(QueryLanguage ql, String query, String baseURI,
    Dataset dataset, boolean includeInferred, int maxQueryTime, Binding... bindings)
{
  List<NameValuePair> queryParams = new ArrayList<NameValuePair>();
  /*
   * Only query, default-graph-uri, and named-graph-uri are standard parameters in SPARQL Protocol 1.1.
   */
  if (query != null) {
    if (baseURI != null && !baseURI.equals("")) {
      // prepend query string with base URI declaration
      query = "BASE <" + baseURI + "> \n" + query;
    }
    queryParams.add(new BasicNameValuePair(Protocol.QUERY_PARAM_NAME, query));
  }
  if (dataset != null) {
    for (IRI defaultGraphURI : dataset.getDefaultGraphs()) {
      queryParams.add(new BasicNameValuePair(Protocol.DEFAULT_GRAPH_PARAM_NAME,
          String.valueOf(defaultGraphURI)));
    }
    for (IRI namedGraphURI : dataset.getNamedGraphs()) {
      queryParams.add(new BasicNameValuePair(Protocol.NAMED_GRAPH_PARAM_NAME,
          String.valueOf(namedGraphURI)));
    }
  }
  return queryParams;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-client

protected List<NameValuePair> getQueryMethodParameters(QueryLanguage ql, String query, String baseURI,
    Dataset dataset, boolean includeInferred, int maxQueryTime, Binding... bindings)
{
  List<NameValuePair> queryParams = new ArrayList<NameValuePair>();
  /*
   * Only query, default-graph-uri, and named-graph-uri are standard parameters in SPARQL Protocol 1.1.
   */
  if (query != null) {
    if (baseURI != null && !baseURI.equals("")) {
      // prepend query string with base URI declaration
      query = "BASE <" + baseURI + "> \n" + query;
    }
    queryParams.add(new BasicNameValuePair(Protocol.QUERY_PARAM_NAME, query));
  }
  if (dataset != null) {
    for (IRI defaultGraphURI : dataset.getDefaultGraphs()) {
      queryParams.add(new BasicNameValuePair(Protocol.DEFAULT_GRAPH_PARAM_NAME,
          String.valueOf(defaultGraphURI)));
    }
    for (IRI namedGraphURI : dataset.getNamedGraphs()) {
      queryParams.add(new BasicNameValuePair(Protocol.NAMED_GRAPH_PARAM_NAME,
          String.valueOf(namedGraphURI)));
    }
  }
  return queryParams;
}

代码示例来源:origin: eclipse/rdf4j

protected List<NameValuePair> getQueryMethodParameters(QueryLanguage ql, String query, String baseURI,
    Dataset dataset, boolean includeInferred, int maxQueryTime, Binding... bindings)
{
  List<NameValuePair> queryParams = new ArrayList<>();
  /*
   * Only query, default-graph-uri, and named-graph-uri are standard parameters in SPARQL Protocol 1.1.
   */
  if (query != null) {
    if (baseURI != null && !baseURI.equals("")) {
      // prepend query string with base URI declaration
      query = "BASE <" + baseURI + "> \n" + query;
    }
    queryParams.add(new BasicNameValuePair(Protocol.QUERY_PARAM_NAME, query));
  }
  if (dataset != null) {
    for (IRI defaultGraphURI : dataset.getDefaultGraphs()) {
      queryParams.add(new BasicNameValuePair(Protocol.DEFAULT_GRAPH_PARAM_NAME,
          String.valueOf(defaultGraphURI)));
    }
    for (IRI namedGraphURI : dataset.getNamedGraphs()) {
      queryParams.add(new BasicNameValuePair(Protocol.NAMED_GRAPH_PARAM_NAME,
          String.valueOf(namedGraphURI)));
    }
  }
  return queryParams;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

for (IRI defaultGraphURI : dataset.getDefaultGraphs()) {
  queryParams.add(new BasicNameValuePair(Protocol.DEFAULT_GRAPH_PARAM_NAME,
      String.valueOf(defaultGraphURI)));

代码示例来源:origin: eclipse/rdf4j

for (IRI defaultGraphURI : dataset.getDefaultGraphs()) {
  queryParams.add(new BasicNameValuePair(Protocol.DEFAULT_GRAPH_PARAM_NAME,
      String.valueOf(defaultGraphURI)));

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-client

for (IRI defaultGraphURI : dataset.getDefaultGraphs()) {
  queryParams.add(new BasicNameValuePair(Protocol.DEFAULT_GRAPH_PARAM_NAME,
      String.valueOf(defaultGraphURI)));

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client

String.valueOf(dataset.getDefaultInsertGraph())));
for (IRI defaultGraphURI : dataset.getDefaultGraphs()) {
  queryParams.add(new BasicNameValuePair(Protocol.USING_GRAPH_PARAM_NAME,
      String.valueOf(defaultGraphURI)));

代码示例来源:origin: eclipse/rdf4j

String.valueOf(dataset.getDefaultInsertGraph())));
for (IRI defaultGraphURI : dataset.getDefaultGraphs()) {
  queryParams.add(new BasicNameValuePair(Protocol.USING_GRAPH_PARAM_NAME,
      String.valueOf(defaultGraphURI)));

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-client

String.valueOf(dataset.getDefaultInsertGraph())));
for (IRI defaultGraphURI : dataset.getDefaultGraphs()) {
  queryParams.add(new BasicNameValuePair(Protocol.USING_GRAPH_PARAM_NAME,
      String.valueOf(defaultGraphURI)));

代码示例来源:origin: ontop/ontop

public static OntopSemanticIndexLoader loadRDFGraph(Dataset dataset, Properties properties)
    throws SemanticIndexException {
  // Merge default and named graphs to filter duplicates
  Set<IRI> graphURLs = new HashSet<>();
  graphURLs.addAll(dataset.getDefaultGraphs());
  graphURLs.addAll(dataset.getNamedGraphs());
  OntopModelConfiguration defaultConfiguration = OntopModelConfiguration.defaultBuilder().build();
  Injector injector = defaultConfiguration.getInjector();
  RDF rdfFactory = injector.getInstance(RDF.class);
  CollectRDFVocabulary collectVocabulary = new CollectRDFVocabulary(rdfFactory);
  for (IRI graphURL : graphURLs) {
    processRDF(collectVocabulary, graphURL);
  }
  Ontology vocabulary = collectVocabulary.vb.build();
  SIRepository repo = new SIRepository(vocabulary.tbox(), defaultConfiguration.getTermFactory(),
      defaultConfiguration.getTypeFactory(),
      injector.getInstance(TargetAtomFactory.class));
  Connection connection = repo.createConnection();
  //  Load the data
  SemanticIndexRDFHandler insertData = new SemanticIndexRDFHandler(repo, connection,
      defaultConfiguration.getTypeFactory(), defaultConfiguration.getTermFactory(),
      injector.getInstance(RDF.class));
  for (IRI graphURL : graphURLs) {
    processRDF(insertData, graphURL);
  }
  LOG.info("Inserted {} triples", insertData.count);
  return new OntopSemanticIndexLoaderImpl(repo, connection, properties, Optional.empty() /* no tbox */);
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-dataset

void loadDataset(Dataset datasets)
  throws QueryEvaluationException
{
  try {
    if (datasets == null) {
      return;
    }
    for (IRI dataset : datasets.getDefaultGraphs()) {
      repository.loadDataset(new URL(dataset.toString()), dataset, getParserConfig());
    }
    for (IRI dataset : datasets.getNamedGraphs()) {
      repository.loadDataset(new URL(dataset.toString()), dataset, getParserConfig());
    }
  }
  catch (MalformedURLException e) {
    throw new QueryEvaluationException(e);
  }
  catch (RepositoryException e) {
    throw new QueryEvaluationException(e);
  }
}

代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-repository-dataset

void loadDataset(Dataset datasets)
  throws QueryEvaluationException
{
  try {
    if (datasets == null) {
      return;
    }
    for (IRI dataset : datasets.getDefaultGraphs()) {
      repository.loadDataset(new URL(dataset.toString()), dataset, getParserConfig());
    }
    for (IRI dataset : datasets.getNamedGraphs()) {
      repository.loadDataset(new URL(dataset.toString()), dataset, getParserConfig());
    }
  }
  catch (MalformedURLException e) {
    throw new QueryEvaluationException(e);
  }
  catch (RepositoryException e) {
    throw new QueryEvaluationException(e);
  }
}

代码示例来源:origin: joshsh/sesametools

public CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluateByGraphNames(
    final TupleExpr tupleExpr,
    final Dataset dataset,
    final BindingSet bindings,
    final boolean includeInferred) throws SailException {
  Dataset d;
  if (null == dataset) {
    d = this.readableSet;
  } else {
    SimpleDataset di = new SimpleDataset();
    d = di;
    for (IRI r : dataset.getDefaultGraphs()) {
      if (this.readPermitted(r)) {
        di.addDefaultGraph(r);
      }
    }
    for (IRI r : dataset.getNamedGraphs()) {
      if (this.readPermitted(r)) {
        di.addNamedGraph(r);
      }
    }
  }
  return super.evaluate(tupleExpr, d, bindings, includeInferred);
}

相关文章