public Document newDocument(Activity[] ps, Entity[] as, Agent[] ags, Statement[] lks) { return newDocument(((ps == null) ? null : Arrays.asList(ps)), ((as == null) ? null : Arrays.asList(as)), ((ags == null) ? null : Arrays.asList(ags)), ((lks == null) ? null : Arrays.asList(lks))); }
public Document newDocument(Activity[] ps, Entity[] as, Agent[] ags, Statement[] lks) { return newDocument(((ps == null) ? null : Arrays.asList(ps)), ((as == null) ? null : Arrays.asList(as)), ((ags == null) ? null : Arrays.asList(ags)), ((lks == null) ? null : Arrays.asList(lks))); }
public Converter(ProvFactory pFactory) { this.pFactory = pFactory; class1 = pFactory.newDocument().getClass(); gson = new GsonBuilder().registerTypeAdapter(class1, new ProvDocumentDeserializer(pFactory)) .registerTypeAdapter(class1, new ProvDocumentSerializer(pFactory)) .setPrettyPrinting().create(); }
public Converter(ProvFactory pFactory) { this.pFactory = pFactory; class1 = pFactory.newDocument().getClass(); gson = new GsonBuilder().registerTypeAdapter(class1, new ProvDocumentDeserializer(pFactory)) .registerTypeAdapter(class1, new ProvDocumentSerializer(pFactory)) .setPrettyPrinting().create(); }
public Document toDocument_v2 () { List<Statement> ll=new LinkedList<Statement>(); add1DValues_v2(ll,variables); add2Dvalues_v2(ll,attributes); Document dummy=pf.newDocument(null,ll,new LinkedList<Bundle>()); Document result=pf.newDocument(pf.newNamespace(Namespace.gatherNamespaces(dummy)),ll,new LinkedList<Bundle>()); return result; }
public Document toDocument () { List<Statement> ll=new LinkedList<Statement>(); add1DValues(ll,variables); add2Dvalues(ll,attributes); Document dummy=pf.newDocument(null,ll,new LinkedList<Bundle>()); Document result=pf.newDocument(pf.newNamespace(Namespace.gatherNamespaces(dummy)),ll,new LinkedList<Bundle>()); return result; }
public Document toDocument_v2 () { List<Statement> ll=new LinkedList<Statement>(); add1DValues_v2(ll,variables); add2Dvalues_v2(ll,attributes); Document dummy=pf.newDocument(null,ll,new LinkedList<Bundle>()); Document result=pf.newDocument(pf.newNamespace(Namespace.gatherNamespaces(dummy)),ll,new LinkedList<Bundle>()); return result; }
public Document toDocument () { List<Statement> ll=new LinkedList<Statement>(); add1DValues(ll,variables); add2Dvalues(ll,attributes); Document dummy=pf.newDocument(null,ll,new LinkedList<Bundle>()); Document result=pf.newDocument(pf.newNamespace(Namespace.gatherNamespaces(dummy)),ll,new LinkedList<Bundle>()); return result; }
@Override public Document deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject provJSONDoc = json.getAsJsonObject(); // Initialise namespaces currentNamespace = decodePrefixes(provJSONDoc); documentNamespace = currentNamespace; // Decoding structures List<StatementOrBundle> statements = decodeBundle(provJSONDoc); // Create the document Document doc = pf.newDocument(); doc.setNamespace(currentNamespace); doc.getStatementOrBundle().addAll(statements); return doc; }
@Override public Document deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject provJSONDoc = json.getAsJsonObject(); // Initialise namespaces currentNamespace = decodePrefixes(provJSONDoc); documentNamespace = currentNamespace; // Decoding structures List<StatementOrBundle> statements = decodeBundle(provJSONDoc); // Create the document Document doc = pf.newDocument(); doc.setNamespace(currentNamespace); doc.getStatementOrBundle().addAll(statements); return doc; }
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 Document toDocument() { Document res=pFactory.newDocument(); List<StatementOrBundle> statementOrBundle = res.getStatementOrBundle(); toContainer(statementOrBundle); if (!flatten) { for (QualifiedName bunId: bundleMap.keySet()) { IndexedDocument idoc=bundleMap.get(bunId); Bundle bun=pFactory.newNamedBundle(bunId, null); List<StatementOrBundle> ll=new LinkedList<StatementOrBundle>(); idoc.toContainer(ll); for (StatementOrBundle s: ll) { bun.getStatement().add((Statement) s); } bun.setNamespace(Namespace.gatherNamespaces(bun)); statementOrBundle.add(bun); } } res.setNamespace(Namespace.gatherNamespaces(res)); return res; } private void toContainer(List<StatementOrBundle> statementOrBundle) {
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 toDocument() { Document res=pFactory.newDocument(); List<StatementOrBundle> statementOrBundle = res.getStatementOrBundle(); toContainer(statementOrBundle); if (!flatten) { for (QualifiedName bunId: bundleMap.keySet()) { IndexedDocument idoc=bundleMap.get(bunId); Bundle bun=pFactory.newNamedBundle(bunId, null); List<StatementOrBundle> ll=new LinkedList<StatementOrBundle>(); idoc.toContainer(ll); for (StatementOrBundle s: ll) { bun.getStatement().add((Statement) s); } bun.setNamespace(Namespace.gatherNamespaces(bun)); statementOrBundle.add(bun); } } res.setNamespace(Namespace.gatherNamespaces(res)); return res; } private void toContainer(List<StatementOrBundle> statementOrBundle) {
public void makeDocAndTest(Statement []stment, Bundle[] bundles, String file, Statement[] opt, boolean check) { Document doc = pFactory.newDocument(); for (int i=0; i< stment.length; i++) { doc.getStatementOrBundle().add(stment[i]); } if (bundles!=null) { for (int j=0; j<bundles.length; j++) { doc.getStatementOrBundle().add(bundles[j]); } } updateNamespaces(doc); String file1=(opt==null) ? file : file+"-S"; compareDocAndFile(doc, file1, check); if (opt!=null) { String file2=file+"-M"; doc.getStatementOrBundle().addAll(Arrays.asList(opt)); compareDocAndFile(doc, file2, check); } }
public void makeDocAndTest(Statement []stment, Bundle[] bundles, String file, Statement[] opt, boolean check) { Document doc = pFactory.newDocument(); for (int i=0; i< stment.length; i++) { doc.getStatementOrBundle().add(stment[i]); } if (bundles!=null) { for (int j=0; j<bundles.length; j++) { doc.getStatementOrBundle().add(bundles[j]); } } updateNamespaces(doc); String file1=(opt==null) ? file : file+"-S"; compareDocAndFile(doc, file1, check); if (opt!=null) { String file2=file+"-M"; doc.getStatementOrBundle().addAll(Arrays.asList(opt)); compareDocAndFile(doc, file2, check); } }
public void makeDocAndTest(Statement[] stment, Bundle[] bundles, String file, Statement[] opt, boolean check) { Document doc = pFactory.newDocument(); for (int i = 0; i < stment.length; i++) { doc.getStatementOrBundle().add(stment[i]); } if (bundles != null) { for (int j = 0; j < bundles.length; j++) { doc.getStatementOrBundle().add(bundles[j]); } } updateNamespaces(doc); if (bundles!=null) { for (int j = 0; j < bundles.length; j++) { bundles[j].getNamespace().setParent(doc.getNamespace()); } } String file1 = (opt == null) ? file : file + "-S"; compareDocAndFile(doc, file1, check); if ((opt != null) && doOptional(opt)) { String file2 = file + "-M"; doc.getStatementOrBundle().addAll(Arrays.asList(opt)); compareDocAndFile(doc, file2, check); } }
public void makeDocAndTest(Statement[] stment, Bundle[] bundles, String file, Statement[] opt, boolean check) { Document doc = pFactory.newDocument(); for (int i = 0; i < stment.length; i++) { doc.getStatementOrBundle().add(stment[i]); } if (bundles != null) { for (int j = 0; j < bundles.length; j++) { doc.getStatementOrBundle().add(bundles[j]); } } updateNamespaces(doc); if (bundles!=null) { for (int j = 0; j < bundles.length; j++) { bundles[j].getNamespace().setParent(doc.getNamespace()); } } String file1 = (opt == null) ? file : file + "-S"; compareDocAndFile(doc, file1, check); if ((opt != null) && doOptional(opt)) { String file2 = file + "-M"; doc.getStatementOrBundle().addAll(Arrays.asList(opt)); compareDocAndFile(doc, file2, check); } }
public void makeDocAndTest(Statement[] stment, Bundle[] bundles, String file, Statement[] opt, boolean check) { Document doc = pFactory.newDocument(); for (int i = 0; i < stment.length; i++) { doc.getStatementOrBundle().add(stment[i]); } if (bundles != null) { for (int j = 0; j < bundles.length; j++) { doc.getStatementOrBundle().add(bundles[j]); } } updateNamespaces(doc); if (bundles!=null) { for (int j = 0; j < bundles.length; j++) { bundles[j].getNamespace().setParent(doc.getNamespace()); } } String file1 = (opt == null) ? file : file + "-S"; compareDocAndFile(doc, file1, check); if ((opt != null) && doOptional(opt)) { String file2 = file + "-M"; doc.getStatementOrBundle().addAll(Arrays.asList(opt)); compareDocAndFile(doc, file2, check); } }