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

x33g5p2x  于2022-01-24 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(100)

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

Namespace.getName介绍

[英]Gets the name of the current namespace (i.e. its IRI).
[中]获取当前命名空间的名称(即其IRI)。

代码示例

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

@Override
public boolean containsValue(Object nextValue) {
  if (nextValue instanceof String) {
    for (Namespace nextNamespace : namespaces) {
      if (nextNamespace.getName().equals(nextValue)) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.apache.marmotta/kiwi-triplestore

@Override
public int compareTo(Namespace other) {
  return uri.compareTo(other.getName());
}

代码示例来源:origin: apache/marmotta

@Override
public int compareTo(Namespace other) {
  return uri.compareTo(other.getName());
}

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

@Override
  public Collection<String> values() {
    List<String> result = new ArrayList<String>();
    for (Namespace nextNamespace : namespaces) {
      result.add(nextNamespace.getName());
    }
    return result;
  }
};

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

@Override
public String remove(Object nextKey) {
  String result = null;
  for (Namespace nextNamespace : new LinkedHashSet<Namespace>(namespaces)) {
    if (nextNamespace.getPrefix().equals(nextKey)) {
      result = nextNamespace.getName();
      namespaces.remove(nextNamespace);
    }
  }
  return result;
}

代码示例来源:origin: com.github.jsonld-java/jsonld-java-sesame

private static void addPrefixes(Map<String, Object> ctx, Set<Namespace> namespaces) {
    for (final Namespace ns : namespaces) {
      ctx.put(ns.getPrefix(), ns.getName());
    }

  }
}

代码示例来源:origin: org.apache.rya/mongodb.rya

@Override
public int compareTo(final Namespace o) {
  if (!namespace.equalsIgnoreCase(o.getName())) {
    return namespace.compareTo(o.getName());
  }
  if (!prefix.equalsIgnoreCase(o.getPrefix())) {
    return prefix.compareTo(o.getPrefix());
  }
  return 0;
}

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

@Override
public String get(Object nextKey) {
  if (nextKey instanceof String) {
    for (Namespace nextNamespace : namespaces) {
      if (nextNamespace.getPrefix().equals(nextKey)) {
        return nextNamespace.getName();
      }
    }
  }
  return null;
}

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

@Override
protected String getNamespaceInternal(String prefix)
  throws SailException
{
  Namespace ns = namespaces.findByPrefix(prefix);
  if (ns == null)
    return null;
  return ns.getName();
}

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

/**
 * NOTE: This entry set is immutable, and does not update the internal
 * set through its iterator.
 */
@Override
public Set<java.util.Map.Entry<String, String>> entrySet() {
  Set<java.util.Map.Entry<String, String>> result = new LinkedHashSet<Map.Entry<String, String>>();
  for (Namespace nextNamespace : namespaces) {
    AbstractMap.SimpleImmutableEntry<String, String> nextEntry = new SimpleImmutableEntry<String, String>(
        nextNamespace.getPrefix(), nextNamespace.getName());
    result.add(nextEntry);
  }
  return Collections.unmodifiableSet(result);
}

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

@Override
public String put(String nextKey, String nextValue) {
  String result = null;
  for (Namespace nextNamespace : new LinkedHashSet<Namespace>(namespaces)) {
    if (nextNamespace.getPrefix().equals(nextKey)) {
      result = nextNamespace.getName();
      namespaces.remove(nextNamespace);
    }
  }
  namespaces.add(new SimpleNamespace(nextKey, nextValue));
  return result;
}

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

public Map<String, String> asMap()
    throws StoreException
  {
    Map<String, String> map = new HashMap<String, String>();
    Namespace ns;
    while ((ns = next()) != null) {
      map.put(ns.getPrefix(), ns.getName());
    }
    return map;
  }
}

代码示例来源:origin: io.konig/konig-schemagen

private void writeNamespaces(NamespaceManager nsManager, RDFWriter turtle) throws RDFHandlerException {
  
  List<Namespace> list = new ArrayList<>(nsManager.listNamespaces());
  
  Collections.sort(list, new Comparator<Namespace>(){
    @Override
    public int compare(Namespace a, Namespace b) {
      return a.getPrefix().compareTo(b.getPrefix());
    }});
  
  for (Namespace ns : list) {
    turtle.handleNamespace(ns.getPrefix(), ns.getName());
  }
  
     
}

代码示例来源:origin: eu.fbk.rdfpro/rdfpro-rules

/**
 * Sets the prefix for a namespace.
 *
 * @param namespace
 *            a {@link Namespace} object to use in this Model.
 */
public final void setNamespace(final Namespace namespace) {
  doSetNamespace(namespace.getPrefix(), namespace.getName());
}

代码示例来源:origin: io.konig/konig-schemagen

private void addContext() throws IOException {
    
    json.writeObjectFieldStart("@context");
    
    List<Namespace> list = new ArrayList<>(nsManager.listNamespaces());
    Collections.sort(list, new NamespaceComparator());
    for (Namespace namespace : list) {
      json.writeStringField(namespace.getPrefix(), namespace.getName());
    }
    
    json.writeEndObject();
    
  }
}

代码示例来源:origin: net.fortytwo.sesametools/common

@Override
public void setNamespace(Namespace namespace) {
  rc.setNamespace(namespace.getPrefix(), namespace.getName());
}

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

@Override
  public int compareTo(Namespace o) {
    if (getPrefix().equals(o.getPrefix())) {
      if (getName().equals(o.getName())) {
        return 0;
      }
      else {
        return getName().compareTo(o.getName());
      }
    }
    else {
      return getPrefix().compareTo(o.getPrefix());
    }
  }
}

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

protected void initializeNamespaceTableFromConfiguration() {
  for (Namespace aNS : getParserConfig().get(BasicParserSettings.NAMESPACES)) {
    namespaceTable.put(aNS.getPrefix(), aNS.getName());
  }
}

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

private Namespaces getNamespaces(RepositoryConnection connection) throws RepositoryException {
  Namespaces ns = new Namespaces();
  RepositoryResult<Namespace> rr = null;
  try {
    rr=connection.getNamespaces();
    while(rr.hasNext()) {
      Namespace n=rr.next();
      ns.addPrefix(n.getPrefix(), n.getName());
    }
  } finally {
    closeQuietly(rr,"Could not close results after retrieving namespaces");
  }
  return ns;
}

代码示例来源:origin: io.konig/konig-schemagen

private void declareNamespaces(NamespaceManager nsManager, Graph graph) {
  
  declareVann(graph);
  
  Collection<Namespace> list = nsManager.listNamespaces();
  for (Namespace ns : list) {
    URI nsURI = uri(ns.getName());
    Vertex v = graph.vertex(nsURI);
    
    if (v.getValue(VANN.preferredNamespacePrefix) == null) {
      v.addProperty(VANN.preferredNamespacePrefix, literal(ns.getPrefix()));
    }
    
    if (!v.hasProperty(RDF.TYPE, OWL.ONTOLOGY)) {
      v.addProperty(RDF.TYPE, OWL.ONTOLOGY);
    }
    
  }
  
}

相关文章