本文整理了Java中org.eclipse.rdf4j.query.Dataset.getNamedGraphs()
方法的一些代码示例,展示了Dataset.getNamedGraphs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dataset.getNamedGraphs()
方法的具体详情如下:
包路径:org.eclipse.rdf4j.query.Dataset
类名称:Dataset
方法名:getNamedGraphs
[英]Gets the named graph URIs of this dataset. An empty named graph set and a non-empty default graph set indicates that there are no named graphs. 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-query
public Set<IRI> getNamedGraphs() {
Set<IRI> set = primary.getNamedGraphs();
if (set == null || set.isEmpty())
return fallback.getNamedGraphs();
return set;
}
代码示例来源:origin: eclipse/rdf4j
@Override
public Set<IRI> getNamedGraphs() {
Set<IRI> set = primary.getNamedGraphs();
if (set == null || set.isEmpty())
return fallback.getNamedGraphs();
return set;
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
public Set<IRI> getNamedGraphs() {
Set<IRI> set = primary.getNamedGraphs();
if (set == null || set.isEmpty())
return fallback.getNamedGraphs();
return set;
}
代码示例来源:origin: joshsh/sesametools
/**
* This Sail is writable if the base Sail is writable, and insofar as the
* the statements to be written are permitted by the access control
* mechanism.
*/
public boolean isWritable() throws SailException {
return getBaseSail().isWritable()
&& (!writableSet.getNamedGraphs().isEmpty()); // TODO: OR the default analysis is writable
}
代码示例来源: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
String.valueOf(defaultGraphURI)));
for (IRI namedGraphURI : dataset.getNamedGraphs()) {
queryParams.add(new BasicNameValuePair(Protocol.NAMED_GRAPH_PARAM_NAME,
String.valueOf(namedGraphURI)));
代码示例来源:origin: eclipse/rdf4j
String.valueOf(defaultGraphURI)));
for (IRI namedGraphURI : dataset.getNamedGraphs()) {
queryParams.add(new BasicNameValuePair(Protocol.NAMED_GRAPH_PARAM_NAME,
String.valueOf(namedGraphURI)));
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-client
String.valueOf(defaultGraphURI)));
for (IRI namedGraphURI : dataset.getNamedGraphs()) {
queryParams.add(new BasicNameValuePair(Protocol.NAMED_GRAPH_PARAM_NAME,
String.valueOf(namedGraphURI)));
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
String.valueOf(defaultGraphURI)));
for (IRI namedGraphURI : dataset.getNamedGraphs()) {
queryParams.add(new BasicNameValuePair(Protocol.USING_NAMED_GRAPH_PARAM_NAME,
String.valueOf(namedGraphURI)));
代码示例来源:origin: eclipse/rdf4j
String.valueOf(defaultGraphURI)));
for (IRI namedGraphURI : dataset.getNamedGraphs()) {
queryParams.add(new BasicNameValuePair(Protocol.USING_NAMED_GRAPH_PARAM_NAME,
String.valueOf(namedGraphURI)));
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-client
String.valueOf(defaultGraphURI)));
for (IRI namedGraphURI : dataset.getNamedGraphs()) {
queryParams.add(new BasicNameValuePair(Protocol.USING_NAMED_GRAPH_PARAM_NAME,
String.valueOf(namedGraphURI)));
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-client
String.valueOf(defaultGraphURI)));
for (IRI namedGraphURI : dataset.getNamedGraphs()) {
queryParams.add(new BasicNameValuePair(Protocol.USING_NAMED_GRAPH_PARAM_NAME,
String.valueOf(namedGraphURI)));
代码示例来源:origin: eclipse/rdf4j
String.valueOf(defaultGraphURI)));
for (IRI namedGraphURI : dataset.getNamedGraphs()) {
queryParams.add(new BasicNameValuePair(Protocol.USING_NAMED_GRAPH_PARAM_NAME,
String.valueOf(namedGraphURI)));
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
String.valueOf(defaultGraphURI)));
for (IRI namedGraphURI : dataset.getNamedGraphs()) {
queryParams.add(new BasicNameValuePair(Protocol.USING_NAMED_GRAPH_PARAM_NAME,
String.valueOf(namedGraphURI)));
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!