org.eclipse.rdf4j.repository.RepositoryConnection.getNamespaces()方法的使用及代码示例

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

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

RepositoryConnection.getNamespaces介绍

[英]Gets all declared namespaces as a RepositoryResult of Namespace objects. Each Namespace object consists of a prefix and a namespace name.
[中]将所有声明的命名空间作为命名空间对象的RepositoryResult获取。每个名称空间对象由前缀和名称空间名称组成。

代码示例

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

@Override
public RepositoryResult<Namespace> getNamespaces()
  throws RepositoryException
{
  return getDelegate().getNamespaces();
}

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

@Override
public RepositoryResult<Namespace> getNamespaces()
  throws RepositoryException
{
  return getDelegate().getNamespaces();
}

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

protected CloseableIteration<? extends Namespace, SailException> getNamespacesInternal()
    throws SailException {
  try {
    return new RepositoryNamespaceIteration(
        repoConnection.getNamespaces());
  } catch (RepositoryException e) {
    throw new SailException(e);
  }
}

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

@Override
public Set<Namespace> getNamespaces() {
  Function<Namespace, Namespace> f = identity();
  return toSet(rc.getNamespaces(), f);
}

代码示例来源:origin: com.powsybl/powsybl-triple-store-impl-rdf4j

private static void copyNamespacesToModel(RepositoryConnection conn, Model m) {
  RepositoryResult<Namespace> ns = conn.getNamespaces();
  while (ns.hasNext()) {
    m.setNamespace(ns.next());
  }
}

代码示例来源:origin: streampipes/streampipes-ce

@Override
public List<Namespace> getNamespaces() throws RepositoryException {
  
  List<Namespace> result = new ArrayList<>();
  RepositoryResult<org.eclipse.rdf4j.model.Namespace> namespaces = repo.getConnection().getNamespaces();
  
  while(namespaces.hasNext())
  {
    org.eclipse.rdf4j.model.Namespace ns = namespaces.next();
    result.add(new Namespace(ns.getPrefix(), ns.getName()));
  }
  return result;
  
}

代码示例来源:origin: org.streampipes/streampipes-storage-rdf4j

@Override
public List<Namespace> getNamespaces() throws RepositoryException {
  
  List<Namespace> result = new ArrayList<>();
  RepositoryResult<org.eclipse.rdf4j.model.Namespace> namespaces = repo.getConnection().getNamespaces();
  
  while(namespaces.hasNext())
  {
    org.eclipse.rdf4j.model.Namespace ns = namespaces.next();
    result.add(new Namespace(ns.getPrefix(), ns.getName()));
  }
  return result;
  
}

代码示例来源:origin: franzinc/agraph-java-client

@Override
public void testGetNamespaces()
    throws Exception {
  setupNamespaces();
  Map<String, String> map = Namespaces.asMap(Iterations.asSet(testCon.getNamespaces()));
  assertThat(map.size(), is(equalTo(3)));
  assertThat(map.keySet(), hasItems("example", "rdfs", "rdf"));
  assertThat(map.get("example"), is(equalTo("http://example.org/")));
  assertThat(map.get("rdfs"), is(equalTo("http://www.w3.org/2000/01/rdf-schema#")));
  assertThat(map.get("rdf"), is(equalTo("http://www.w3.org/1999/02/22-rdf-syntax-ns#")));
}

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

CloseableIteration<? extends Namespace, RepositoryException> iter = repositoryCon.getNamespaces();

代码示例来源:origin: franzinc/agraph-java-client

@Test
public void testGetNamespaces()
    throws Exception {
  StringBuilder rdfFragment = new StringBuilder();
  rdfFragment.append("<rdf:RDF\n");
  rdfFragment.append("    xmlns:example='http://example.org/'\n");
  rdfFragment.append("    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'\n");
  rdfFragment.append("    xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#' >\n");
  rdfFragment.append("  <rdf:Description rdf:about='http://example.org/Main'>\n");
  rdfFragment.append("    <rdfs:label>Main Node</rdfs:label>\n");
  rdfFragment.append("  </rdf:Description>\n");
  rdfFragment.append("</rdf:RDF>");
  testCon.add(new StringReader(rdfFragment.toString()), "", RDFFormat.RDFXML);
  try (CloseableIteration<? extends Namespace, RepositoryException> nsIter = testCon.getNamespaces()) {
    int nsCount = 0;
    while (nsIter.hasNext()) {
      nsCount++;
      nsIter.next();
    }
    assertEquals("Namespaces from imported RDF should not be added to repository", 0, nsCount);
  }
}

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

namespaces = getDelegate().getNamespaces();
List<String> prefix = new ArrayList<>();
try {

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

namespaces = getDelegate().getNamespaces();
List<String> prefix = new ArrayList<String>();
try {

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

namespaces = getDelegate().getNamespaces();
List<String> prefix = new ArrayList<String>();
try {

相关文章

微信公众号

最新文章

更多