com.hp.hpl.jena.rdf.model.Model.removeNsPrefix()方法的使用及代码示例

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

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

Model.removeNsPrefix介绍

暂无

代码示例

代码示例来源:origin: fr.inria.eventcloud/eventcloud-api

/**
 * {@inheritDoc}
 */
@Override
public PrefixMapping removeNsPrefix(String prefix) {
  return super.object.removeNsPrefix(prefix);
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.jena

@Override
public void removeNamespace(String prefix) {
  this.jenaModel.removeNsPrefix(prefix);
}

代码示例来源:origin: bio2rdf/bio2rdf-scripts

public PrefixMapping removeNsPrefix(String prefix) {
  return model.removeNsPrefix(prefix);
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.jena

/**
 * Remove the specified namespace from all {@linkplain Model}s
 * in this {@linkplain ModelSet} including the default graph.
 */
@Override
public void removeNamespace(String prefix) {
  this.dataset.getDefaultModel().removeNsPrefix(prefix);
  Iterator<Model> it = this.getModels();
  while (it.hasNext()) {
    it.next().removeNamespace(prefix);
  }
}

代码示例来源:origin: org.ow2.weblab.core.helpers/rdf-helper-jena

/**
 * @return The RDF/XML String view of the model.
 */
public String getRdfXml() {
  final List<String> prefixToRemove = new LinkedList<String>();
  for (final Object prefix : this.model.getNsPrefixMap().keySet()) {
    if (prefix.toString().startsWith("j.")) {
      prefixToRemove.add(prefix.toString());
    }
  }
  for (final String prefix : prefixToRemove) {
    this.model.removeNsPrefix(prefix);
  }
  final StringWriter writer = new StringWriter();
  try {
    this.model.write(writer, BackEndJenaHelper.SYNTAX);
  } catch (final Exception e) {
    throw new RDFHelperException("Serialisation of Jena model " + "failed. " + BackEndJenaHelper.SYNTAX + "string appears to be invalid: "
        + writer.toString(), e);
  }
  return writer.toString().replace("\r", "");
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

@Override public void call(Model boundModel) {
    Model contents = getContentsAsModel();
    if (contents == null) { // syntax error?
      return;
    }
    // Namespace prefixes
    Iterator it = contents.getNsPrefixMap().keySet().iterator();
    while (it.hasNext()) {
      String prefix = (String) it.next();
      if (prefix.length() > 0)
        boundModel.removeNsPrefix(prefix);
    }
    boundModel.remove(contents);
    turtleTextArea.requestFocusInWindow();
  }
});

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

@Override public void call(Model boundModel) {
    Model contents = getContentsAsModel();
    if (contents == null) { // syntax error?
      return;
    }
    // Namespace prefixes
    Iterator it = boundModel.getNsPrefixMap().keySet().iterator();
    while (it.hasNext()) {
      String prefix = (String) it.next();
      boundModel.removeNsPrefix(prefix);
    }
    boundModel.setNsPrefixes(contents);
    boundModel.removeAll();
    boundModel.add(contents);
    turtleTextArea.requestFocusInWindow();
    // Model contains the contents of the text area so we're synced
    outOfSync = false;
    turtleTextArea.fileSaved = !outOfSync;
  }
});

相关文章

Model类方法