org.openrdf.model.Namespace类的使用及代码示例

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

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

Namespace介绍

[英]A namespace, consisting of a namespace name and a prefix that has been assigned to it.
[中]

代码示例

代码示例来源: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: io.konig/konig-schemagen

@Override
  public int compare(Namespace a, Namespace b) {
    return a.getPrefix().compareTo(b.getPrefix());
  }
});

代码示例来源: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: io.konig/konig-schemagen

@Override
public int compare(Namespace a, Namespace b) {
  return a.getPrefix().compareTo(b.getPrefix());
}});

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

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

代码示例来源: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: io.konig/konig-schemagen

@Override
public int compare(Namespace a, Namespace b) {
  return a.getPrefix().compareTo(b.getPrefix());
}

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

@Override
public int compareTo(Namespace other) {
  return uri.compareTo(other.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 boolean containsKey(Object nextKey) {
  if (nextKey instanceof String) {
    for (Namespace nextNamespace : namespaces) {
      if (nextNamespace.getPrefix().equals(nextKey)) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源: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: org.openrdf.sesame/sesame-model

@Override
public Set<String> keySet() {
  Set<String> result = new LinkedHashSet<String>();
  for (Namespace nextNamespace : namespaces) {
    result.add(nextNamespace.getPrefix());
  }
  return result;
}

代码示例来源: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: 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: org.openrdf.sesame/sesame-model

@Override
public Optional<Namespace> getNamespace(String prefix) {
  for (Namespace nextNamespace : namespaces) {
    if (prefix.equals(nextNamespace.getPrefix())) {
      return Optional.of(nextNamespace);
    }
  }
  return Optional.empty();
}

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

/**
 * Sets the prefix for a namespace. This will replace any existing namespace
 * associated to the prefix.
 * 
 * @param prefix
 *        The new prefix.
 * @param name
 *        The namespace name that the prefix maps to.
 * @return The {@link Namespace} object for the given namespace.
 */
public default Namespace setNamespace(String prefix, String name) {
  Optional<? extends Namespace> result = getNamespace(prefix);
  if (!result.isPresent() || !result.get().getName().equals(name)) {
    result = Optional.of(new SimpleNamespace(prefix, name));
    setNamespace(result.get());
  }
  return result.get();
}

代码示例来源: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 Optional<Namespace> getNamespace(String prefix) {
  for (Namespace nextNamespace : namespaces) {
    if (prefix.equals(nextNamespace.getPrefix())) {
      return Optional.of(nextNamespace);
    }
  }
  return Optional.empty();
}

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

buffer = new StringBuffer();
  buffer.append(ns.getName());
} else if (p != null) {

相关文章