org.openprovenance.prov.model.Namespace.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(144)

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

Namespace.<init>介绍

暂无

代码示例

代码示例来源:origin: lucmoreau/ProvToolbox

protected synchronized Namespace initialValue () {
   return new Namespace();
   }
};

代码示例来源:origin: org.openprovenance.prov/prov-model

public Namespace newNamespace() {
return new Namespace();
}

代码示例来源:origin: lucmoreau/ProvToolbox

public Namespace newNamespace() {
return new Namespace();
}

代码示例来源:origin: org.openprovenance.prov/prov-model

protected synchronized Namespace initialValue () {
   return new Namespace();
   }
};

代码示例来源:origin: org.openprovenance.prov/prov-model

public Namespace newNamespace(Namespace ns) {
return new Namespace(ns);
}

代码示例来源:origin: lucmoreau/ProvToolbox

public Namespace newNamespace(Namespace ns) {
return new Namespace(ns);
}

代码示例来源:origin: lucmoreau/ProvToolbox

public void configurePrefixes(Marshaller m) throws PropertyException {
  configurePrefixes(m,new Namespace());
}

代码示例来源:origin: lucmoreau/ProvToolbox

/** Initializes a Document's namespace. */
public void setNamespaces(Document doc) {
  if (doc.getNamespace() == null)
    doc.setNamespace(new Namespace());
}

代码示例来源:origin: lucmoreau/ProvToolbox

private Namespace decodePrefixes(JsonObject bundleStructure) {
Namespace ns = new Namespace();
// prefixes prov and xsd are implicit in prov-json
ns.addKnownNamespaces();
JsonObject prefixes = getObjectAndRemove(bundleStructure,
           PROV_JSON_PREFIX);
if (prefixes != null) {
  for (Map.Entry<String, JsonElement> pair : prefixes.entrySet()) {
  String prefix = pair.getKey();
  String uri = pair.getValue().getAsString();
  if (prefix.equals("default")) {
    ns.registerDefault(uri);
  } else {
    ns.register(prefix, uri);
  }
  }
}
return ns;
}

代码示例来源:origin: org.openprovenance.prov/prov-template

public Document expander(Document docIn, Bindings bindings1) {
  
  Bundle bun = (Bundle) docIn.getStatementOrBundle().get(0);
  Groupings grp1 = Groupings.fromDocument(docIn);
  logger.debug("expander: Found groupings " + grp1);
  Bundle bun1 = (Bundle) expand(bun, bindings1, grp1).get(0);
  Document doc1 = pf.newDocument();
  doc1.getStatementOrBundle().add(bun1);
  bun1.setNamespace(Namespace.gatherNamespaces(bun1));
  doc1.setNamespace(new Namespace());
  return doc1;
}

代码示例来源:origin: lucmoreau/ProvToolbox

public Document expander(Document docIn, Bindings bindings1) {
  
  Bundle bun = (Bundle) docIn.getStatementOrBundle().get(0);
  Groupings grp1 = Groupings.fromDocument(docIn);
  logger.debug("expander: Found groupings " + grp1);
  Bundle bun1 = (Bundle) expand(bun, bindings1, grp1).get(0);
  Document doc1 = pf.newDocument();
  doc1.getStatementOrBundle().add(bun1);
  bun1.setNamespace(Namespace.gatherNamespaces(bun1));
  doc1.setNamespace(new Namespace());
  return doc1;
}

代码示例来源:origin: org.openprovenance.prov/prov-model

public Bundle doAction(Bundle b, ProvUtilities u) {
List<Statement> sRecords = new LinkedList<Statement>();
QualifiedName bundleId=b.getId();

   Namespace old=Namespace.getThreadNamespace();
Namespace bundleNamespace;
if (b.getNamespace()!=null) {
  bundleNamespace=new Namespace(b.getNamespace());
} else {
  bundleNamespace=new Namespace();
}
bundleNamespace.setParent(new Namespace(old)); //ensure to make a copy of old, since setting might otherwise create a loop
Namespace.withThreadNamespace(bundleNamespace);
  c.startBundle(bundleId, b.getNamespace());
  
for (Statement s : u.getStatement(b)) {
  sRecords.add((Statement) u.doAction(s, this));
}
return c.newNamedBundle(bundleId, b.getNamespace(), sRecords);
}

代码示例来源:origin: lucmoreau/ProvToolbox

public Bundle doAction(Bundle b, ProvUtilities u) {
List<Statement> sRecords = new LinkedList<Statement>();
QualifiedName bundleId=b.getId();

   Namespace old=Namespace.getThreadNamespace();
Namespace bundleNamespace;
if (b.getNamespace()!=null) {
  bundleNamespace=new Namespace(b.getNamespace());
} else {
  bundleNamespace=new Namespace();
}
bundleNamespace.setParent(new Namespace(old)); //ensure to make a copy of old, since setting might otherwise create a loop
Namespace.withThreadNamespace(bundleNamespace);
  c.startBundle(bundleId, b.getNamespace());
  
for (Statement s : u.getStatement(b)) {
  sRecords.add((Statement) u.doAction(s, this));
}
return c.newNamedBundle(bundleId, b.getNamespace(), sRecords);
}

代码示例来源:origin: org.openprovenance.prov/prov-model

public Document newDocument(Document graph) {
Document res = of.createDocument();
res.getStatementOrBundle()
  .addAll(graph.getStatementOrBundle());
if (graph.getNamespace()!=null) {
  res.setNamespace(new Namespace(graph.getNamespace()));
}
return res;
}

代码示例来源:origin: lucmoreau/ProvToolbox

public Document getDocument() {
  root = graph.getHead();
  Document doc = pf.newDocument();
  Namespace ns = new Namespace();
  ns.setDefaultNamespace(namespace);
  List<Statement> statements = new LinkedList<Statement>();
  getElements(root, graph, ns, statements);
  doc.getStatementOrBundle().addAll(statements);
  doc.setNamespace(ns);
  if (term != null) {
    addSeed(doc, seed, term);
  }
  return doc;
}

代码示例来源:origin: lucmoreau/ProvToolbox

public Document newDocument(Document graph) {
Document res = of.createDocument();
res.getStatementOrBundle()
  .addAll(graph.getStatementOrBundle());
if (graph.getNamespace()!=null) {
  res.setNamespace(new Namespace(graph.getNamespace()));
}
return res;
}

代码示例来源:origin: org.openprovenance.prov/prov-model

/** 
 * Accumulate all namespace declarations in a single {@link Namespace} instance. 
 * This includes the Document-level {@link Namespace} but also all Bundle-level {@link Namespace}s.
 * 
 * <p>This method is particular useful before serialization to XML since JAXB doesn't offer us the 
 * means to generate prefix declaration in inner Elements. Hence, all namespaces need to be declared 
 * at the root of the xml document.
 * 
 * @param document Document from which Namespaces are accumulated
 * @return a new instance of {@link Namespace}
 */
static public Namespace accumulateAllNamespaces(Document document) {
Namespace res=new Namespace(document.getNamespace());
for (Bundle b: pu.getNamedBundle(document)) {
  Namespace ns=b.getNamespace();
  if (ns!=null) res.extendWith(ns);
}
return res;
}

代码示例来源:origin: lucmoreau/ProvToolbox

/** 
 * Accumulate all namespace declarations in a single {@link Namespace} instance. 
 * This includes the Document-level {@link Namespace} but also all Bundle-level {@link Namespace}s.
 * 
 * <p>This method is particular useful before serialization to XML since JAXB doesn't offer us the 
 * means to generate prefix declaration in inner Elements. Hence, all namespaces need to be declared 
 * at the root of the xml document.
 * 
 * @param document Document from which Namespaces are accumulated
 * @return a new instance of {@link Namespace}
 */
static public Namespace accumulateAllNamespaces(Document document) {
Namespace res=new Namespace(document.getNamespace());
for (Bundle b: pu.getNamedBundle(document)) {
  Namespace ns=b.getNamespace();
  if (ns!=null) res.extendWith(ns);
}
return res;
}

代码示例来源:origin: org.openprovenance.prov/prov-model

public Document doAction(Document doc) {
List<Bundle> bRecords = new LinkedList<Bundle>();
List<Statement> sRecords = new LinkedList<Statement>();

Namespace docNamespace=doc.getNamespace();
  Namespace.withThreadNamespace(docNamespace);
  c.startDocument(doc.getNamespace());
for (Statement s : u.getStatement(doc)) {
  sRecords.add((Statement) u.doAction(s, this));
}
for (Bundle bu : u.getNamedBundle(doc)) {
  Namespace.withThreadNamespace(new Namespace(docNamespace));
  Bundle o = doAction(bu,u);
  if (o != null)
  bRecords.add(o);
}
return c.newDocument(doc.getNamespace(), sRecords, bRecords);
}

代码示例来源:origin: lucmoreau/ProvToolbox

/**
 * After reading a document, this method should be called to ensure that Namespaces are properly chained.
 * @param document a {@link Document} to update
 */
public void updateNamespaces(Document document) {
Namespace rootNamespace = Namespace.gatherNamespaces(document);
document.setNamespace(rootNamespace);
for (org.openprovenance.prov.model.Bundle bu: utils.getBundle(document)) {
  Namespace ns=bu.getNamespace();
  if (ns!=null) {
  ns.setParent(rootNamespace);
  } else {
  ns=new Namespace();
  ns.setParent(rootNamespace);
  bu.setNamespace(ns);
  }
}
}

相关文章