static public Set<QualifiedName> freeVariables(Bundle statement) { HashSet<QualifiedName> result = new HashSet<QualifiedName>(); QualifiedName name = statement.getId(); if (name != null && isVariable(name)) { result.add(name); } return result; }
static public Set<QualifiedName> freeVariables(Bundle statement) { HashSet<QualifiedName> result = new HashSet<QualifiedName>(); QualifiedName name = statement.getId(); if (name != null && isVariable(name)) { result.add(name); } return result; }
@Override public void doAction(Bundle bun, ProvUtilities provUtilities) { if (flatten) { provUtilities.forAllStatement(bun.getStatement(), this); } else { IndexedDocument iDoc=bundleMap.get(bun.getId()); if (iDoc==null) { iDoc=new IndexedDocument(pFactory, null,flatten); bundleMap.put(bun.getId(),iDoc); } u.forAllStatement(bun.getStatement(), iDoc); } }
@Override public void doAction(Bundle bun, ProvUtilities provUtilities) { if (flatten) { provUtilities.forAllStatement(bun.getStatement(), this); } else { IndexedDocument iDoc=bundleMap.get(bun.getId()); if (iDoc==null) { iDoc=new IndexedDocument(pFactory, null,flatten); bundleMap.put(bun.getId(),iDoc); } u.forAllStatement(bun.getStatement(), iDoc); } }
@Override public void doAction(Bundle bu, ProvUtilities u) { register(bu.getId()); for (Statement s2: bu.getStatement()) { u.doAction(s2, this); } }
@Override public void doAction(Bundle bu, ProvUtilities u) { register(bu.getId()); for (Statement s2: bu.getStatement()) { u.doAction(s2, this); } }
public void updateEnvironmentForBundleId(Bundle bun, Bindings bindings1, Hashtable<QualifiedName, QualifiedName> env0) { final QualifiedName id = bun.getId(); if (ExpandUtil.isVariable(id)) { List<QualifiedName> vals = bindings1.getVariables().get(id); if (vals == null) { if (Expand.isGensymVariable(id)) { // OK, we'll generate a uuid later } else { throw new BundleVariableHasNoValue(id); } } else { if (vals.size() > 1) { throw new BundleVariableHasMultipleValues(id, vals); } else { env0.put(id, vals.get(0)); } } } }
public void updateEnvironmentForBundleId(Bundle bun, Bindings bindings1, Hashtable<QualifiedName, QualifiedName> env0) { final QualifiedName id = bun.getId(); if (ExpandUtil.isVariable(id)) { List<QualifiedName> vals = bindings1.getVariables().get(id); if (vals == null) { if (Expand.isGensymVariable(id)) { // OK, we'll generate a uuid later } else { throw new BundleVariableHasNoValue(id); } } else { if (vals.size() > 1) { throw new BundleVariableHasMultipleValues(id, vals); } else { env0.put(id, vals.get(0)); } } } }
@Override public void doAction(Bundle bun, ProvUtilities provUtilities) { bun.setId(uniquify(bun.getId())); provUtilities.forAllStatement(bun.getStatement(), this); }
static public Namespace gatherNamespaces(Bundle bundle) { NamespaceGatherer gatherer=new NamespaceGatherer(); u.forAllStatement(bundle.getStatement(), gatherer); gatherer.register(bundle.getId()); Namespace ns=gatherer.getNamespace(); return ns; }
static public Namespace gatherNamespaces(Bundle bundle) { NamespaceGatherer gatherer=new NamespaceGatherer(); u.forAllStatement(bundle.getStatement(), gatherer); gatherer.register(bundle.getId()); Namespace ns=gatherer.getNamespace(); return ns; }
final QualifiedName bunId = bun.getId(); if (ExpandUtil.isVariable(bunId)) {
final QualifiedName bunId = bun.getId(); if (ExpandUtil.isVariable(bunId)) {
static public Namespace gatherNamespaces(Bundle bundle, ProvFactory pFactory) { NamespaceGatherer gatherer=new NamespaceGatherer(); u.forAllStatement(bundle.getStatement(), gatherer); gatherer.register(bundle.getId()); Namespace ns=gatherer.getNamespace(); Namespace ns2=pFactory.newNamespace(ns); return ns2; }
static public Namespace gatherNamespaces(Bundle bundle, ProvFactory pFactory) { NamespaceGatherer gatherer=new NamespaceGatherer(); u.forAllStatement(bundle.getStatement(), gatherer); gatherer.register(bundle.getId()); Namespace ns=gatherer.getNamespace(); Namespace ns2=pFactory.newNamespace(ns); return ns2; }
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 makePC1GraphAndSpecialization(ProvFactory pFactory) { Document graph = pFactory.newDocument(); String bName = "b123"; // needs to be generated Bundle bun = makePC1FullGraph(pFactory, bName); graph.getStatementOrBundle().add(bun); bun.setNamespace(Namespace.gatherNamespaces(bun)); Hashtable<String, String> namespaces = new Hashtable<String, String>(); // currently, no prefix used, all qnames map to PC1_NS namespaces.put("_", EX_NS); // new default namespace namespaces.put("xsd", NamespacePrefixMapper.XSD_NS); namespaces.put(EX_PREFIX, EX_NS); namespaces.put(DOT_PREFIX, DOT_NS); Entity bunEntity = pFactory.newEntity(bun.getId()); Entity a = pFactory.newEntity(new org.openprovenance.prov.xml.QualifiedName(EX_NS, globalA1.getId().getLocalPart(),null)); MentionOf ctx = pFactory.newMentionOf(a.getId(), globalA1.getId(), bunEntity.getId()); a.getOther().add(pFactory.newOther(DOT_NS, DOT_PREFIX, "color", "blue", name.XSD_STRING)); graph.getStatementOrBundle().add(bunEntity); graph.getStatementOrBundle().add(a); graph.getStatementOrBundle().add(ctx); graph.setNamespace(Namespace.gatherNamespaces(graph)); graph.getNamespace().extendWith(bun.getNamespace()); return graph; }