protected synchronized Namespace initialValue () { return new Namespace(); } };
public Namespace newNamespace() { return new Namespace(); }
public Namespace newNamespace() { return new Namespace(); }
protected synchronized Namespace initialValue () { return new Namespace(); } };
public Namespace newNamespace(Namespace ns) { return new Namespace(ns); }
public Namespace newNamespace(Namespace ns) { return new Namespace(ns); }
public void configurePrefixes(Marshaller m) throws PropertyException { configurePrefixes(m,new Namespace()); }
/** Initializes a Document's namespace. */ public void setNamespaces(Document doc) { if (doc.getNamespace() == null) doc.setNamespace(new Namespace()); }
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; }
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; }
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; }
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); }
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); }
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; }
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; }
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; }
/** * 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; }
/** * 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; }
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); }
/** * 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); } } }