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

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

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

Namespace.withThreadNamespace介绍

暂无

代码示例

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

public void prepareNamespaces(Marshaller m, Document document) throws PropertyException {
final Namespace superNamespace = NamespaceGatherer.accumulateAllNamespaces(document);
configurePrefixes(m,superNamespace);
Namespace.withThreadNamespace(superNamespace);
}

代码示例来源: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

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

public void writeDocument(org.openprovenance.prov.model.Document doc,
       String file) {
Namespace.withThreadNamespace(doc.getNamespace());
System.out.println("saving document ... ");
@SuppressWarnings("unused")
Document doc2 = u.persist((org.openprovenance.prov.sql.Document) doc);
dbKeys.put(file, ((org.openprovenance.prov.sql.Document) doc).getPk());
System.out.println("saved document "
  + ((org.openprovenance.prov.sql.Document) doc).getPk()
  + " for " + file);
}

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

public void writeXMLDocument(Document doc, String file) throws JAXBException {
ProvSerialiser serial = ProvSerialiser.getThreadProvSerialiser();
  Namespace.withThreadNamespace(doc.getNamespace());
serial.serialiseDocument(new File(file), doc, true);
StringWriter sw = new StringWriter();
serial.serialiseDocument(sw, doc, true);
}

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

public void writeXMLDocument(Document doc, String file) throws JAXBException {
  
ProvSerialiser serial = ProvSerialiser.getThreadProvSerialiser();
Namespace.withThreadNamespace(doc.getNamespace());
serial.serialiseDocument(new File(file), (org.openprovenance.prov.sql.Document)doc, true);
StringWriter sw = new StringWriter();
serial.serialiseDocument(sw, (org.openprovenance.prov.sql.Document)doc, true);
//System.out.println(sw.toString());
  }
@Override

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

public void writeDocument(Document doc, String file2) {
  Namespace.withThreadNamespace(doc.getNamespace());
  try {
    writeXMLDocument(doc, file2);
  } catch (JAXBException e) {
    throw new UncheckedTestException(e);
  }
}

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

public void writeDocument(Document doc, String file2) {
  Namespace.withThreadNamespace(doc.getNamespace());
  try {
    writeXMLDocument(doc, file2);
  } catch (JAXBException e) {
    throw new UncheckedTestException(e);
  }
}

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

@Override
public void writeDocument(Document doc, String file) {
Namespace.withThreadNamespace(doc.getNamespace());
String s = u.convertBeanToASN(doc,pFactory);
u.writeTextToFile(s, file);
}

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

@Override
public void writeDocument(Document doc, String file) {
  Namespace.withThreadNamespace(doc.getNamespace());
  String s = u.convertBeanToASN(doc,pFactory);
  u.writeTextToFile(s, file);
}

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

public void writeDocument(Document doc, String file2) {
Namespace.withThreadNamespace(doc.getNamespace());
  try {
    writeXMLDocument(doc, file2);
  } catch (JAXBException e) {
    throw new UncheckedTestException(e);
  }
}

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

@Override
public void writeDocument(Document doc, String file) {
Namespace.withThreadNamespace(doc.getNamespace());
String s = u.convertBeanToASN(doc,pFactory);
u.writeTextToFile(s, file);
}

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

public void writeDocument(Document doc, String file2) {
  Namespace.withThreadNamespace(doc.getNamespace());
  try {
    writeXMLDocument(doc, file2);
  } catch (JAXBException e) {
    throw new UncheckedTestException(e);
  }
}

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

@Override
public void writeDocument(Document doc, String file) {
Namespace.withThreadNamespace(doc.getNamespace());
String s = u.convertBeanToASN(doc,pFactory);
u.writeTextToFile(s, file);
}

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

public void testPC1SpecFull() throws JAXBException {
Document graph = makePC1GraphAndSpecialization(pFactory);
ProvSerialiser serial = ProvSerialiser.getThreadProvSerialiser();
  Namespace.withThreadNamespace(graph.getNamespace());
serial.serialiseDocument(new File("target/pc1-spec.xml"), graph, true);
graph1 = graph;
//System.out.println("PC1Full Test asserting True");
assertTrue(true);
}

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

public void subtestPC1Full() throws JAXBException {
Document graph = makePC1FullGraph(pFactory);
ProvSerialiser serial = ProvSerialiser.getThreadProvSerialiser();
  Namespace.withThreadNamespace(graph.getNamespace());
serial.serialiseDocument(new File("target/pc1-full.xml"), graph, true);
graph1 = graph;
//System.out.println("PC1Full Test asserting True");
assertTrue(true);
}

代码示例来源: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 void fileToDot(String asnFile, String xmlFile, String dotFile, String pdfFile, String title)
  throws java.io.FileNotFoundException,  java.io.IOException, JAXBException, Throwable {
  Utility u=new Utility();
  ProvFactory pFactory=ProvFactory.getFactory();
  Document o= (Document) u.convertASNToJavaBean(asnFile,pFactory);
Namespace.withThreadNamespace(o.getNamespace());
System.out.println("ns is " + o.getNamespace());
  ProvSerialiser serial=ProvSerialiser.getThreadProvSerialiser();
  
  serial.serialiseDocument(new File(xmlFile),o,true);
  ProvToDot toDot=new ProvToDot("src/main/resources/defaultConfigWithRoleNoLabel.xml"); 
  
  toDot.convert(o,dotFile,pdfFile,title);
}

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

public void sculptureToDot(String asnFile, String xmlFile, String dotFile, String pdfFile, String title) 
  throws java.io.FileNotFoundException,  java.io.IOException, JAXBException, Throwable {
  Utility u=new Utility();
  ProvFactory pFactory=ProvFactory.getFactory();
  Document o= (Document) u.convertASNToJavaBean(asnFile,pFactory);
  Namespace.withThreadNamespace(o.getNamespace());
  ProvSerialiser serial=ProvSerialiser.getThreadProvSerialiser();
  
  serial.serialiseDocument(new File(xmlFile),o,true);
  ProvToDot toDot=new ProvToDot("src/main/resources/defaultConfigWithRoleNoLabel.xml"); 
  
  toDot.convert(o,dotFile,pdfFile,title);
}

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

public void testReadASNSaveXML(String file, String file2) throws java.io.IOException, java.lang.Throwable {
  Utility u=new Utility();
  CommonTree tree = u.convertASNToTree(file);
  Object o2=u.convertTreeToJavaBean(tree,pFactory);
  graph1=(Document)o2;
  graph1.setNamespace(Namespace.gatherNamespaces(graph1));
  try {
    ProvSerialiser serial=ProvSerialiser.getThreadProvSerialiser();
    Namespace.withThreadNamespace(graph1.getNamespace());
    serial.serialiseDocument(new File(file2),(Document)o2,true);
    assertTrue(true);
  } catch (JAXBException e) {
    e.printStackTrace();
  }
}

相关文章