org.eclipse.rdf4j.rio.RDFHandler.handleNamespace()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(92)

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

RDFHandler.handleNamespace介绍

[英]Handles a namespace declaration/definition. A namespace declaration associates a (short) prefix string with the namespace's URI. The prefix for default namespaces, which do not have an associated prefix, are represented as empty strings.
[中]处理命名空间声明/定义。名称空间声明将(短)前缀字符串与名称空间的URI相关联。没有关联前缀的默认名称空间的前缀表示为空字符串。

代码示例

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

public void handleNamespace(String prefix, String uri)
  throws RDFHandlerException
{
  for (RDFHandler rdfHandler : rdfHandlers) {
    rdfHandler.handleNamespace(prefix, uri);
  }
}

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

public void handleNamespace(String prefix, String uri)
  throws RDFHandlerException
{
  for (RDFHandler rdfHandler : rdfHandlers) {
    rdfHandler.handleNamespace(prefix, uri);
  }
}

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

@Override
public void handleNamespace(String prefix, String uri)
    throws RDFHandlerException {
  handler.handleNamespace(prefix, uri);
}

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

@Override
public void handleNamespace(String prefix, String uri)
  throws RDFHandlerException
{
  for (RDFHandler rdfHandler : rdfHandlers) {
    rdfHandler.handleNamespace(prefix, uri);
  }
}

代码示例来源:origin: Merck/Halyard

private void handleNamespace(String prefix, String uri) {
  if (rdfHandler != null) {
    rdfHandler.handleNamespace(prefix, uri);
  }
}

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

public void handleNamespace(final String prefix, final String uri) throws RDFHandlerException {
  baseHandler.handleNamespace(prefix, uri);
}

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

public void handleNamespace(final String prefix, final String uri) throws RDFHandlerException {
  baseHandler.handleNamespace(prefix, uri);
}

代码示例来源:origin: owlcs/owlapi

@Override
public void handleNamespace(@Nullable String prefix, @Nullable String uri) {
  try {
    consumer.handleNamespace(prefix, uri);
  } catch (RDFHandlerException e) {
    throw new OWLParserException(e);
  }
}

代码示例来源:origin: net.sourceforge.owlapi/owlapi-rio

@Override
public void handleNamespace(@Nullable String prefix, @Nullable String uri) {
  try {
    consumer.handleNamespace(prefix, uri);
  } catch (RDFHandlerException e) {
    throw new OWLParserException(e);
  }
}

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

private void readNamespaceDecl()
  throws IOException, RDFHandlerException
{
  String prefix = readString();
  String namespace = readString();
  if (rdfHandler != null) {
    rdfHandler.handleNamespace(prefix, namespace);
  }
}

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

private void readNamespaceDecl()
  throws IOException, RDFHandlerException
{
  String prefix = readString();
  String namespace = readString();
  if (rdfHandler != null) {
    rdfHandler.handleNamespace(prefix, namespace);
  }
}

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

private void readNamespaceDecl()
  throws IOException, RDFHandlerException
{
  String prefix = readString();
  String namespace = readString();
  if (rdfHandler != null) {
    rdfHandler.handleNamespace(prefix, namespace);
  }
}

代码示例来源:origin: net.sourceforge.owlapi/owlapi-rio

private void writeNamespaces() {
  // Send the prefixes from the prefixmanager to the RDFHandler
  // NOTE: These may be derived from a PrefixOWLDocumentFormat
  for (String prefixName : pm.getPrefixName2PrefixMap().keySet()) {
    final String prefix = pm.getPrefix(prefixName);
    // OWLAPI generally stores prefixes with a colon at the end, while
    // Sesame Rio expects
    // prefixes without the colon
    if (prefixName.endsWith(":")) {
      prefixName = prefixName.substring(0, prefixName.length() - 1);
    }
    try {
      writer.handleNamespace(prefixName, prefix);
    } catch (RDFHandlerException e) {
      throw new OWLRuntimeException(e);
    }
  }
}

代码示例来源:origin: owlcs/owlapi

private void writeNamespaces() {
  // Send the prefixes from the prefixmanager to the RDFHandler
  // NOTE: These may be derived from a PrefixOWLDocumentFormat
  for (String prefixName : pm.getPrefixName2PrefixMap().keySet()) {
    final String prefix = pm.getPrefix(prefixName);
    // OWLAPI generally stores prefixes with a colon at the end, while
    // Sesame Rio expects
    // prefixes without the colon
    if (prefixName.endsWith(":")) {
      prefixName = prefixName.substring(0, prefixName.length() - 1);
    }
    try {
      writer.handleNamespace(prefixName, prefix);
    } catch (RDFHandlerException e) {
      throw new OWLRuntimeException(e);
    }
  }
}

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

@Override
public void startPrefixMapping(String prefix, String uri)
  throws SAXException
{
  try {
    if (deferredElement != null) {
      // This new prefix mapping must come from a new start tag
      reportDeferredStartElement();
    }
    newNamespaceMappings.put(prefix, uri);
    if (parseLiteralMode) {
      // This namespace is introduced inside an XML literal
      xmlLiteralPrefixes.add(prefix);
    }
    if (rdfParser.getRDFHandler() != null) {
      rdfParser.getRDFHandler().handleNamespace(prefix, uri);
    }
  }
  catch (RDFParseException e) {
    throw new SAXException(e);
  }
  catch (RDFHandlerException e) {
    throw new SAXException(e);
  }
}

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

@Override
public void startPrefixMapping(String prefix, String uri)
  throws SAXException
{
  try {
    if (deferredElement != null) {
      // This new prefix mapping must come from a new start tag
      reportDeferredStartElement();
    }
    newNamespaceMappings.put(prefix, uri);
    if (parseLiteralMode) {
      // This namespace is introduced inside an XML literal
      xmlLiteralPrefixes.add(prefix);
    }
    if (rdfParser.getRDFHandler() != null) {
      rdfParser.getRDFHandler().handleNamespace(prefix, uri);
    }
  }
  catch (RDFParseException e) {
    throw new SAXException(e);
  }
  catch (RDFHandlerException e) {
    throw new SAXException(e);
  }
}

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

@Override
public void exportStatements(Resource subj, IRI pred, Value obj, boolean includeInferred,
    RDFHandler handler, Resource... contexts)
  throws RepositoryException,
  RDFHandlerException
{
  Model model = committed.filter(subj, pred, obj, contexts);
  handler.startRDF();
  model.getNamespaces().forEach(ns -> {
    handler.handleNamespace(ns.getPrefix(), ns.getName());
  });
  model.forEach(st -> {
    handler.handleStatement(st);
  });
  handler.endRDF();
}

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

/**
 * Writes the given statements to the given {@link RDFHandler}.
 * <p>
 * If the collection is a {@link Model}, its namespaces will also be written.
 * 
 * @param model
 *        A collection of statements, such as a {@link Model}, to be written.
 * @throws RDFHandlerException
 *         Thrown if there is an error writing the statements.
 */
public static void write(Iterable<Statement> model, RDFHandler writer)
  throws RDFHandlerException
{
  writer.startRDF();
  if (model instanceof NamespaceAware) {
    for (Namespace nextNamespace : ((NamespaceAware)model).getNamespaces()) {
      writer.handleNamespace(nextNamespace.getPrefix(), nextNamespace.getName());
    }
  }
  for (final Statement st : model) {
    writer.handleStatement(st);
  }
  writer.endRDF();
}

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

/**
 * Writes the given statements to the given {@link RDFHandler}.
 * <p>
 * If the collection is a {@link Model}, its namespaces will also be written.
 * 
 * @param model
 *        A collection of statements, such as a {@link Model}, to be written.
 * @throws RDFHandlerException
 *         Thrown if there is an error writing the statements.
 */
public static void write(Iterable<Statement> model, RDFHandler writer)
  throws RDFHandlerException
{
  writer.startRDF();
  if (model instanceof NamespaceAware) {
    for (Namespace nextNamespace : ((NamespaceAware)model).getNamespaces()) {
      writer.handleNamespace(nextNamespace.getPrefix(), nextNamespace.getName());
    }
  }
  for (final Statement st : model) {
    writer.handleStatement(st);
  }
  writer.endRDF();
}

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

/**
 * Writes the given statements to the given {@link RDFHandler}.
 * <p>
 * If the collection is a {@link Model}, its namespaces will also be written.
 * 
 * @param model
 *        A collection of statements, such as a {@link Model}, to be written.
 * @throws RDFHandlerException
 *         Thrown if there is an error writing the statements.
 */
public static void write(Iterable<Statement> model, RDFHandler writer)
  throws RDFHandlerException
{
  writer.startRDF();
  if (model instanceof NamespaceAware) {
    for (Namespace nextNamespace : ((NamespaceAware)model).getNamespaces()) {
      writer.handleNamespace(nextNamespace.getPrefix(), nextNamespace.getName());
    }
  }
  for (final Statement st : model) {
    writer.handleStatement(st);
  }
  writer.endRDF();
}

相关文章