public Document newDocument(Collection<Activity> ps, Collection<Entity> as, Collection<Agent> ags, Collection<Statement> lks) { Document res = of.createDocument(); res.getStatementOrBundle().addAll(ps); res.getStatementOrBundle().addAll(as); res.getStatementOrBundle().addAll(ags); res.getStatementOrBundle().addAll(lks); return res; }
@Override public Document newDocument(Namespace namespace, Collection<Statement> statements, Collection<Bundle> bundles) { Document res = of.createDocument(); res.setNamespace(namespace); res.getStatementOrBundle() .addAll(statements); res.getStatementOrBundle() .addAll(bundles); return res; }
/** This function allows a document to be merged with this IndexedDocument. If flatten is true, bundles include in the document will be flattend into this one. * * * @param doc the document to be merge into this */ public void merge(Document doc) { u.forAllStatementOrBundle(doc.getStatementOrBundle(), this); }
@Override public Document newDocument(Namespace namespace, Collection<Statement> statements, Collection<Bundle> bundles) { Document res = of.createDocument(); res.setNamespace(namespace); res.getStatementOrBundle() .addAll(statements); res.getStatementOrBundle() .addAll(bundles); return res; }
public IndexedDocument(ProvFactory pFactory, Document doc, boolean flatten) { this.pFactory=pFactory; this.flatten=flatten; if (doc!=null) { this.nss=doc.getNamespace(); u.forAllStatementOrBundle(doc.getStatementOrBundle(), this); } }
public IndexedDocument(ProvFactory pFactory, Document doc, boolean flatten) { this.pFactory=pFactory; this.flatten=flatten; if (doc!=null) { this.nss=doc.getNamespace(); u.forAllStatementOrBundle(doc.getStatementOrBundle(), this); } }
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 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 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; }
static public Namespace gatherNamespaces(Document doc) { NamespaceGatherer gatherer=new NamespaceGatherer(); u.forAllStatementOrBundle(doc.getStatementOrBundle(), gatherer); Namespace ns=gatherer.getNamespace(); return ns; }
public void testDoc402() { Document idoc402=new IndexedDocument(pFactory,makeDoc402()).toDocument(); assertEquals(idoc402.getStatementOrBundle().size(),1); Used u=(Used) idoc402.getStatementOrBundle().get(0); assertEquals("label",1,u.getLabel().size()); }
public void testDoc603() { Document idoc603=new IndexedDocument(pFactory,makeDoc603()).toDocument(); assertEquals(idoc603.getStatementOrBundle().size(),1); WasDerivedFrom u=(WasDerivedFrom) idoc603.getStatementOrBundle().get(0); assertEquals("label",1,u.getLabel().size()); assertEquals("other",2,u.getOther().size()); }
public void testDoc200() { Document idoc200=new IndexedDocument(pFactory,makeDoc200()).toDocument(); assertEquals(idoc200.getStatementOrBundle().size(),1); } public Document makeDoc201() {
public void testDoc203() { Document idoc203=new IndexedDocument(pFactory,makeDoc203()).toDocument(); assertEquals(idoc203.getStatementOrBundle().size(),1); Entity e=(Entity)idoc203.getStatementOrBundle().get(0); assertEquals("label", e.getLabel().size(),1); assertEquals("location", e.getLocation().size(),1); assertEquals("type", e.getType().size(),1); assertEquals("other", e.getOther().size(),1); }
public void testDoc1301() { final Document doc = makeDoc1301(); Document idoc1301=new IndexedDocument(pFactory,doc).toDocument(); assertEquals(idoc1301.getStatementOrBundle().size(),1); }
public void testDoc300() { Document idoc300=new IndexedDocument(pFactory,makeDoc300()).toDocument(); assertEquals(idoc300.getStatementOrBundle().size(),1); } public Document makeDoc301() {
public void testDoc2002() throws JAXBException { Document doc=makeDoc2000(); // flattening! Document idoc2000=new IndexedDocument(pFactory,doc,true).toDocument(); ProvSerialiser.getThreadProvSerialiser().serialiseDocument(new File("target/doc2002.xml"), idoc2000, true); assertEquals(idoc2000.getStatementOrBundle().size(),2); }
public Document makeDoc600() { Entity e1=pFactory.newEntity(q("e1")); Entity e2=pFactory.newEntity(q("e2")); //Activity a1=pFactory.newActivity(q("a1")); WasDerivedFrom wdf1=pFactory.newWasDerivedFrom(null,e2.getId(),e1.getId()); Document doc=pFactory.newDocument(); doc.getStatementOrBundle().add(wdf1); doc.getStatementOrBundle().add(wdf1); Namespace nss=Namespace.gatherNamespaces(doc); doc.setNamespace(nss); return doc; }
public Document makeDoc700() { Agent ag1=pFactory.newAgent(q("ag1")); Activity a1=pFactory.newActivity(q("a1")); WasAssociatedWith waw1=pFactory.newWasAssociatedWith(null,a1.getId(),ag1.getId()); Document doc=pFactory.newDocument(); doc.getStatementOrBundle().add(waw1); doc.getStatementOrBundle().add(waw1); Namespace nss=Namespace.gatherNamespaces(doc); doc.setNamespace(nss); return doc; }
public Document makeDoc1000() { Entity e1=pFactory.newEntity(q("e1")); Entity e2=pFactory.newEntity(q("e2")); SpecializationOf spec=pFactory.newSpecializationOf(e1.getId(),e2.getId()); Document doc=pFactory.newDocument(); doc.getStatementOrBundle().add(spec); doc.getStatementOrBundle().add(spec); Namespace nss=Namespace.gatherNamespaces(doc); doc.setNamespace(nss); return doc; }