diff --git a/nbactions.xml b/nbactions.xml
index a6bd608..691decd 100644
--- a/nbactions.xml
+++ b/nbactions.xml
@@ -10,10 +10,10 @@
org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
- --enable-preview -Xmx32G -Xms32G --add-opens java.base/java.nio=ALL-UNNAMED
+ --enable-preview -Xmx32G -Xms32G --add-opens java.base/java.nio=ALL-UNNAMED -Darrow.memory.debug.allocator=true
${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}
- com.ebremer.beakgraph.rdf.BeakGraph
+ com.ebremer.beakgraph.rdf.Test
java
@@ -27,10 +27,10 @@
org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
- --enable-preview -Xmx32G -Xms32G --add-opens java.base/java.nio=ALL-UNNAMED -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}
+ --enable-preview -Xmx32G -Xms32G --add-opens java.base/java.nio=ALL-UNNAMED -Darrow.memory.debug.allocator=true -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}
${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}
- com.ebremer.beakgraph.rdf.BeakGraph
+ com.ebremer.beakgraph.rdf.Test
java
true
@@ -45,9 +45,9 @@
org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
- --enable-preview -Xmx32G -Xms32G --add-opens java.base/java.nio=ALL-UNNAMED
+ --enable-preview -Xmx32G -Xms32G --add-opens java.base/java.nio=ALL-UNNAMED -Darrow.memory.debug.allocator=true
${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}
- com.ebremer.beakgraph.rdf.BeakGraph
+ com.ebremer.beakgraph.rdf.Test
java
diff --git a/pom.xml b/pom.xml
index ccd4ff0..24d3c28 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,14 +3,14 @@
4.0.0
com.ebremer
BeakGraph
- 0.0.0
+ 0.1.0
jar
org.apache.maven.plugins
maven-compiler-plugin
- 3.10.1
+ 3.11.0
--enable-preview
@@ -25,13 +25,14 @@
17
com.ebremer.beakgraph.BeakGraph
4.6.1
- 11.0.0
+ 11.0.0
+ 2.11.5
com.ebremer
RO-Crate4J
- 0.0.0
+ 0.1.0
org.apache.jena
@@ -51,6 +52,11 @@
${jena.ver}
jar
+
+ org.apache.arrow
+ arrow-memory-core
+ ${arrow.version}
+
org.apache.arrow
arrow-vector
@@ -84,7 +90,7 @@
net.lingala.zip4j
zip4j
- 2.11.2
+ ${zip4j.version}
jar
diff --git a/src/main/java/com/ebremer/beakgraph/rdf/BeakGraph.java b/src/main/java/com/ebremer/beakgraph/rdf/BeakGraph.java
index dbd651b..c9acb95 100644
--- a/src/main/java/com/ebremer/beakgraph/rdf/BeakGraph.java
+++ b/src/main/java/com/ebremer/beakgraph/rdf/BeakGraph.java
@@ -106,6 +106,7 @@ public ReorderTransformation getReorderTransform() {
return null;
}
+ /*
public static void main(String[] args) throws IOException {
//JenaSystem.init();
//File f = new File("D:\\HalcyonStorage\\heatmaps\\j3.zip");
@@ -155,5 +156,5 @@ public static void main(String[] args) throws IOException {
QueryExecution qe = QueryExecutionFactory.create(pss.toString(), m);
ResultSet rs = qe.execSelect();
ResultSetFormatter.out(System.out,rs);
- }
+ }*/
}
diff --git a/src/main/java/com/ebremer/beakgraph/rdf/BeakReader.java b/src/main/java/com/ebremer/beakgraph/rdf/BeakReader.java
index bed9cb4..40f8909 100644
--- a/src/main/java/com/ebremer/beakgraph/rdf/BeakReader.java
+++ b/src/main/java/com/ebremer/beakgraph/rdf/BeakReader.java
@@ -71,19 +71,20 @@ public BeakReader(URI uri) throws FileNotFoundException, IOException {
String x = qs.get("file").asResource().getURI();
try {
SeekableByteChannel xxx = reader.getSeekableByteChannel(x);
- ArrowFileReader afr = new ArrowFileReader(xxx, root);
- VectorSchemaRoot za = afr.getVectorSchemaRoot();
- afr.loadNextBatch();
- StructVector v = (StructVector) za.getVector(0);
- String p = v.getName();
- String dt = p.substring(0, 1);
- numtriples = numtriples + v.getValueCount();
- p = p.substring(1);
- if (!byPredicate.containsKey(p)) {
- byPredicate.put(p, new PAR(p));
+ try (ArrowFileReader afr = new ArrowFileReader(xxx, root)) {
+ VectorSchemaRoot za = afr.getVectorSchemaRoot();
+ afr.loadNextBatch();
+ StructVector v = (StructVector) za.getVector(0);
+ String p = v.getName();
+ String dt = p.substring(0, 1);
+ numtriples = numtriples + v.getValueCount();
+ p = p.substring(1);
+ if (!byPredicate.containsKey(p)) {
+ byPredicate.put(p, new PAR(p));
+ }
+ PAR par = byPredicate.get(p);
+ par.put(dt, v);
}
- PAR par = byPredicate.get(p);
- par.put(dt, v);
} catch (FileNotFoundException ex) {
Logger.getLogger(ROCrateReader.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
diff --git a/src/main/java/com/ebremer/beakgraph/rdf/BeakWriter.java b/src/main/java/com/ebremer/beakgraph/rdf/BeakWriter.java
index 9dd6529..5dffb97 100644
--- a/src/main/java/com/ebremer/beakgraph/rdf/BeakWriter.java
+++ b/src/main/java/com/ebremer/beakgraph/rdf/BeakWriter.java
@@ -1,7 +1,6 @@
package com.ebremer.beakgraph.rdf;
import com.ebremer.rocrate4j.ROCrate;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.channels.Channels;
@@ -28,9 +27,11 @@
import net.lingala.zip4j.model.FileHeader;
import net.lingala.zip4j.model.enums.CompressionMethod;
import org.apache.arrow.memory.BufferAllocator;
+import org.apache.arrow.memory.RootAllocator;
import org.apache.arrow.vector.FieldVector;
import org.apache.arrow.vector.LargeVarCharVector;
import org.apache.arrow.vector.VectorSchemaRoot;
+import org.apache.arrow.vector.complex.StructVector;
import org.apache.arrow.vector.dictionary.Dictionary;
import org.apache.arrow.vector.dictionary.DictionaryProvider.MapDictionaryProvider;
import org.apache.arrow.vector.ipc.ArrowFileWriter;
@@ -49,48 +50,25 @@
*
* @author erich
*/
-public final class BeakWriter {
+public final class BeakWriter implements AutoCloseable {
+ private NodeTable nt;
+ private final BufferAllocator allocator;
private final MapDictionaryProvider provider = new MapDictionaryProvider();
- private Dictionary dictionary;
private final CopyOnWriteArrayList fields = new CopyOnWriteArrayList<>();
private final CopyOnWriteArrayList vectors = new CopyOnWriteArrayList<>();
- private NodeTable nt;
- private LargeVarCharVector dict;
private Resource metairi;
private final HashMap byPredicate = new HashMap<>();
private final HashMap blanknodes;
private final ConcurrentHashMap Jobs = new ConcurrentHashMap<>();
private final HashMap resources = new HashMap<>();
- private boolean locked = false;
- private String base;
- private ROCrate.ROCrateBuilder roc;
- private BufferAllocator allocator;
+ private final String base;
private final BGVoID VoID = new BGVoID();
+ private LargeVarCharVector dict;
- public BeakWriter(BufferAllocator allocator, ROCrate.ROCrateBuilder roc, String base) throws IOException {
- //this.m = m;
- this.allocator = allocator;
+ public BeakWriter(ROCrate.ROCrateBuilder roc, String base) {
+ this.allocator = new RootAllocator();
this.base = base;
- this.roc = roc;
- //StopWatch sw = new StopWatch();
- //sw.LapStart("Create Dictionary");
blanknodes = new HashMap<>(2500000);
- //CreateDictionary(allocator);
- //nt = new NodeTable(dictionary);
- //nt.setBlankNodes(blanknodes);
- //sw.Lap("Dictionary Created");
- //sw.LapStart("Create Predicate Vectors");
-
- //System.out.println("# of vectors : "+vectors.size());
- //sw.Lap("Predicate Vectors Created");
-
- //sw.LapStart("Generate VoID Data");
- //Model VoID = BGVoID.GenerateVoID(metairi, m);
- //metairi.getModel().add(VoID);
- //sw.Lap("VoID Data Generated");
-
- //DisplayMeta();
- //sw.Lapse("BeakGraph Completed");
}
public Resource getMetaIRI() {
@@ -143,11 +121,11 @@ public void Register(Model m) {
public void Add(Model m) {
m.listStatements().forEach(s->{
- ProcessTriple(allocator, s);
+ ProcessTriple(s);
});
}
- public void CreateDictionary(BufferAllocator allocator) {
+ public void CreateDictionary() {
System.out.println("Creating Dictionary...");
DictionaryEncoding dictionaryEncoding = new DictionaryEncoding(0, true, new ArrowType.Int(32, true));
dict = new LargeVarCharVector("Resource Dictionary", allocator);
@@ -161,9 +139,9 @@ public void CreateDictionary(BufferAllocator allocator) {
dict.setValueCount(resources.size());
System.out.println("RESOURCES # : "+resources.size());
System.out.println("BNODES # : "+blanknodes.size());
- dictionary = new Dictionary(dict, dictionaryEncoding);
+ Dictionary dictionary = new Dictionary(dict, dictionaryEncoding);
provider.put(dictionary);
- locked = true;
+ //locked = true;
nt = new NodeTable(dictionary);
//blanknodes.forEach((k,v)->{
// blanknodes.put(k,v-blanknodes.size());
@@ -229,34 +207,35 @@ public Resource WriteDataToFile(String base, ROCrate.ROCrateBuilder roc) {
root.setRowCount(v.getValueCount());
OutputStream zos = roc.getDestination().GetOutputStream(base+"/"+MD5(v.getName().getBytes()), CompressionMethod.STORE);
CountingOutputStream cos = new CountingOutputStream(zos);
- ArrowFileWriter writer = new ArrowFileWriter(root, null, Channels.newChannel(cos));
- writer.start();
- writer.writeBatch();
- writer.end();
- long numbytes = cos.getNumberOfBytesWritten();
- if (zos instanceof ZipOutputStream zz) {
- FileHeader fh = zz.closeEntry();
- fh.setUncompressedSize(numbytes);
+ try (SpecialArrowFileWriter writer = new SpecialArrowFileWriter(root, null, Channels.newChannel(cos))) {
+ writer.start();
+ writer.writeBatch();
+ writer.end();
+ long numbytes = cos.getNumberOfBytesWritten();
+ if (zos instanceof ZipOutputStream zz) {
+ FileHeader fh = zz.closeEntry();
+ fh.setUncompressedSize(numbytes);
+ }
+ roc
+ .Add(target, base, MD5(v.getField().getName().getBytes()), CompressionMethod.STORE, true)
+ .addProperty(SchemaDO.name, v.getField().getName().substring(1))
+ .addProperty(BG.property, ResourceFactory.createResource(v.getName().substring(1,v.getName().length())))
+ .addProperty(SchemaDO.encodingFormat, "application/vnd.apache.arrow.file")
+ .addLiteral(SchemaDO.contentSize, numbytes)
+ .addProperty(RDF.type, SchemaDO.MediaObject)
+ .addLiteral(BG.triples, v.getValueCount())
+ .addProperty(RDF.type, BG.PredicateVector);
}
- roc
- .Add(target, base, MD5(v.getField().getName().getBytes()), CompressionMethod.STORE, true)
- .addProperty(SchemaDO.name, v.getField().getName().substring(1))
- .addProperty(BG.property, ResourceFactory.createResource(v.getName().substring(1,v.getName().length())))
- .addProperty(SchemaDO.encodingFormat, "application/vnd.apache.arrow.file")
- .addLiteral(SchemaDO.contentSize, numbytes)
- .addProperty(RDF.type, SchemaDO.MediaObject)
- .addLiteral(BG.triples, v.getValueCount())
- .addProperty(RDF.type, BG.PredicateVector);
} catch (IOException ex) {
Logger.getLogger(BeakWriter.class.getName()).log(Level.SEVERE, null, ex);
}
+ v.close();
});
System.out.println("================== FILE WRITTEN =====================================");
return target;
}
- public void ProcessTriple(BufferAllocator allocator, Statement stmt) {
- //System.out.println("ProcessTriple : "+stmt);
+ public void ProcessTriple(Statement stmt) {
VoID.Add(stmt);
Resource res = stmt.getSubject();
String s;
@@ -293,7 +272,7 @@ public void ProcessTriple(BufferAllocator allocator, Statement stmt) {
} else switch (ct) {
case "org.apache.jena.rdf.model.impl.ResourceImpl": {
if (!byPredicate.containsKey(p)) {
- byPredicate.put(p, new PAW(allocator, nt, p));
+ byPredicate.put(p, new PAW(allocator.newChildAllocator("PAW -> "+p, 0, 1024*1024*1024), nt, p));
}
byPredicate.get(p).set(res, o.asResource());
break;
@@ -301,7 +280,7 @@ public void ProcessTriple(BufferAllocator allocator, Statement stmt) {
case "java.math.BigInteger": {
long oo = o.asLiteral().getLong();
if (!byPredicate.containsKey(p)) {
- byPredicate.put(p, new PAW(allocator, nt, p));
+ byPredicate.put(p, new PAW(allocator.newChildAllocator("PAW -> "+p, 0, 1024*1024*1024), nt, p));
}
byPredicate.get(p).set(res, oo);
break;
@@ -309,7 +288,7 @@ public void ProcessTriple(BufferAllocator allocator, Statement stmt) {
case "java.lang.Integer": {
int oo = o.asLiteral().getInt();
if (!byPredicate.containsKey(p)) {
- byPredicate.put(p, new PAW(allocator, nt, p));
+ byPredicate.put(p, new PAW(allocator.newChildAllocator("PAW -> "+p, 0, 1024*1024*1024), nt, p));
}
byPredicate.get(p).set(res, oo);
break;
@@ -317,7 +296,7 @@ public void ProcessTriple(BufferAllocator allocator, Statement stmt) {
case "java.lang.Long": {
long oo = o.asLiteral().getLong();
if (!byPredicate.containsKey(p)) {
- byPredicate.put(p, new PAW(allocator, nt, p));
+ byPredicate.put(p, new PAW(allocator.newChildAllocator("PAW -> "+p, 0, 1024*1024*1024), nt, p));
}
byPredicate.get(p).set(res, oo);
break;
@@ -325,7 +304,7 @@ public void ProcessTriple(BufferAllocator allocator, Statement stmt) {
case "java.lang.Float": {
float oo = o.asLiteral().getFloat();
if (!byPredicate.containsKey(p)) {
- byPredicate.put(p, new PAW(allocator, nt, p));
+ byPredicate.put(p, new PAW(allocator.newChildAllocator("PAW -> "+p, 0, 1024*1024*1024), nt, p));
}
byPredicate.get(p).set(res, oo);
break;
@@ -333,7 +312,7 @@ public void ProcessTriple(BufferAllocator allocator, Statement stmt) {
case "java.lang.String": {
String oo = o.asLiteral().toString();
if (!byPredicate.containsKey(p)) {
- byPredicate.put(p, new PAW(allocator, nt, p));
+ byPredicate.put(p, new PAW(allocator.newChildAllocator("PAW -> "+p, 0, 1024*1024*1024), nt, p));
}
byPredicate.get(p).set(res, oo);
break;
@@ -346,7 +325,7 @@ public void ProcessTriple(BufferAllocator allocator, Statement stmt) {
}
}
- public void Create(BufferAllocator allocator) throws IOException {
+ public void Create(ROCrate.ROCrateBuilder roc) throws IOException {
System.out.println("Creating BeakGraph...");
int cores = Runtime.getRuntime().availableProcessors();
System.out.println(cores+" cores available");
@@ -383,6 +362,19 @@ public void run() {
metairi = WriteDictionaryToFile(base, roc);
WriteDataToFile(base, roc);
}
+
+ @Override
+ public void close() {
+ vectors.forEach(v->{
+ v.close();
+ });
+ byPredicate.forEach((k,paw)->{
+ paw.close();
+ });
+ nt.close();
+ dict.close();
+ allocator.close();
+ }
class PredicateProcessor implements Callable {
private final PAW pa;
diff --git a/src/main/java/com/ebremer/beakgraph/rdf/Job.java b/src/main/java/com/ebremer/beakgraph/rdf/Job.java
index 7aab4d8..8f36bac 100644
--- a/src/main/java/com/ebremer/beakgraph/rdf/Job.java
+++ b/src/main/java/com/ebremer/beakgraph/rdf/Job.java
@@ -1,7 +1,3 @@
-/*
- * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
- * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
- */
package com.ebremer.beakgraph.rdf;
import java.util.concurrent.Callable;
diff --git a/src/main/java/com/ebremer/beakgraph/rdf/PAW.java b/src/main/java/com/ebremer/beakgraph/rdf/PAW.java
index 59d7903..9d933ab 100644
--- a/src/main/java/com/ebremer/beakgraph/rdf/PAW.java
+++ b/src/main/java/com/ebremer/beakgraph/rdf/PAW.java
@@ -33,7 +33,7 @@
*
* @author erich
*/
-public class PAW {
+public class PAW implements AutoCloseable {
private final HashMap cs = new HashMap<>();
private final HashMap counts = new HashMap<>();
private final BufferAllocator allocator;
@@ -187,19 +187,18 @@ public void Finish(CopyOnWriteArrayList fields, CopyOnWriteArrayList{
v.getWriter().setValueCount(counts.get(k));
- // System.out.println(p+" ["+k+"] AAA >>> "+counts.get(k)+ " XYXYXYXY "+v.getValueCount()+" === this finish ---> "+v.getChild("o").getValueCount());
-// System.out.println(p+" ZAM ===> "+v);
- // DisplayVector(v.getChild("s"));
- // DisplayVector(v.getChild("o"));
StructVector z = upgrade(k,v,job);
- // System.out.println(p+" ["+k+"] XXX >>> "+z.getValueCount()+" "+z);
- // System.out.println("BF/V : "+fields.size()+" "+vectors.size());
+ v.close();
fields.add(z.getField());
vectors.add(z);
- // System.out.println("AF/V : "+fields.size()+" "+vectors.size());
});
}
+ @Override
+ public void close() {
+ allocator.close();
+ }
+
public StructVector build(DataType datatype) {
Map smeta = new HashMap<>();
smeta.put("rdf:type","rdfs:Resource");
@@ -241,13 +240,11 @@ public StructVector build(DataType datatype) {
}
public void set(Resource s, int o) {
- StructVector sv;
if (!cs.containsKey(INTEGER)) {
cs.put(INTEGER, build(INTEGER));
}
- sv = cs.get(INTEGER);
Count(INTEGER);
- NullableStructWriter writer = sv.getWriter();
+ NullableStructWriter writer = cs.get(INTEGER).getWriter();
writer.start();
writer.integer("s").writeInt(nt.getID(s));
writer.integer("o").writeInt(o);
@@ -255,30 +252,24 @@ public void set(Resource s, int o) {
}
public void set(Resource s, long o) {
- //System.out.println(s.toString()+" "+o);
- StructVector sv;
if (!cs.containsKey(LONG)) {
cs.put(LONG, build(LONG));
}
- sv = cs.get(LONG);
Count(LONG);
- NullableStructWriter writer = sv.getWriter();
+ NullableStructWriter writer = cs.get(LONG).getWriter();
writer.start();
int cc = nt.getID(s);
- //System.out.println("CC : "+cc);
writer.integer("s").writeInt(cc);
writer.bigInt("o").writeBigInt(o);
writer.end();
}
public void set(Resource s, float o) {
- StructVector sv;
if (!cs.containsKey(FLOAT)) {
cs.put(FLOAT, build(FLOAT));
}
- sv = cs.get(FLOAT);
Count(FLOAT);
- NullableStructWriter writer = sv.getWriter();
+ NullableStructWriter writer = cs.get(FLOAT).getWriter();
writer.start();
writer.integer("s").writeInt(nt.getID(s));
writer.float4("o").writeFloat4(o);
@@ -286,30 +277,27 @@ public void set(Resource s, float o) {
}
public void set(Resource s, String o) {
- StructVector sv;
if (!cs.containsKey(STRING)) {
cs.put(STRING, build(STRING));
}
- sv = cs.get(STRING);
Count(STRING);
- NullableStructWriter writer = sv.getWriter();
+ NullableStructWriter writer = cs.get(STRING).getWriter();
writer.start();
writer.integer("s").writeInt(nt.getID(s));
byte[] bytes = o.getBytes();
- ArrowBuf tempBuf = allocator.buffer(bytes.length);
- tempBuf.setBytes(0, bytes);
- writer.varChar("o").writeVarChar(0, bytes.length, tempBuf);
- writer.end();
+ try (ArrowBuf tempBuf = allocator.buffer(bytes.length)) {
+ tempBuf.setBytes(0, bytes);
+ writer.varChar("o").writeVarChar(0, bytes.length, tempBuf);
+ writer.end();
+ }
}
public void set(Resource s, Resource object) {
- StructVector sv;
if (!cs.containsKey(RESOURCE)) {
cs.put(RESOURCE, build(RESOURCE));
}
- sv = cs.get(RESOURCE);
Count(RESOURCE);
- NullableStructWriter writer = sv.getWriter();
+ NullableStructWriter writer = cs.get(RESOURCE).getWriter();
writer.start();
writer.integer("s").writeInt(nt.getID(s));
writer.integer("o").writeInt(nt.getID(object));
diff --git a/src/main/java/com/ebremer/beakgraph/rdf/SpecialArrowFileWriter.java b/src/main/java/com/ebremer/beakgraph/rdf/SpecialArrowFileWriter.java
new file mode 100644
index 0000000..6f0b8fa
--- /dev/null
+++ b/src/main/java/com/ebremer/beakgraph/rdf/SpecialArrowFileWriter.java
@@ -0,0 +1,29 @@
+package com.ebremer.beakgraph.rdf;
+
+import java.io.IOException;
+import java.nio.channels.WritableByteChannel;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.arrow.vector.VectorSchemaRoot;
+import org.apache.arrow.vector.dictionary.DictionaryProvider;
+import org.apache.arrow.vector.ipc.ArrowFileWriter;
+
+/**
+ *
+ * @author erich
+ */
+public class SpecialArrowFileWriter extends ArrowFileWriter {
+
+ public SpecialArrowFileWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out) {
+ super(root, provider, out);
+ }
+
+ @Override
+ public void close() {
+ try {
+ end();
+ } catch (IOException ex) {
+ Logger.getLogger(SpecialArrowFileWriter.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+}
diff --git a/src/main/java/com/ebremer/beakgraph/rdf/Test.java b/src/main/java/com/ebremer/beakgraph/rdf/Test.java
new file mode 100644
index 0000000..a1080f8
--- /dev/null
+++ b/src/main/java/com/ebremer/beakgraph/rdf/Test.java
@@ -0,0 +1,43 @@
+package com.ebremer.beakgraph.rdf;
+
+import com.ebremer.rocrate4j.ROCrate;
+import com.ebremer.rocrate4j.writers.ZipWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.zip.GZIPInputStream;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.ModelFactory;
+import org.apache.jena.riot.Lang;
+import org.apache.jena.riot.RDFDataMgr;
+
+/**
+ *
+ * @author erich
+ */
+public class Test {
+
+ public void yah() throws FileNotFoundException, IOException {
+ ROCrate.ROCrateBuilder builder = new ROCrate.ROCrateBuilder(new ZipWriter(new File("D:\\halcyon\\yay.zip")));
+ Model m = ModelFactory.createDefaultModel();
+ RDFDataMgr.read(m, new GZIPInputStream(new FileInputStream(new File("D:\\halcyon\\src\\TCGA-AA-3872-01Z-00-DX1.eb3732ee-40e3-4ff0-a42b-d6a85cfbab6a.ttl.gz"))), Lang.TURTLE);
+ //RDFDataMgr.read(m, new FileInputStream(new File("D:\\halcyon\\src\\yay.ttl")), Lang.TURTLE);
+ System.out.println("SIZE : "+m.size());
+ try (BeakWriter bw = new BeakWriter(builder, "halcyon")) {
+ bw.Register(m);
+ bw.CreateDictionary();
+ bw.Add(m);
+ bw.Create(builder);
+ } catch (java.lang.IllegalStateException ex) {
+ System.out.println(ex.toString());
+ } catch (Exception ex) {
+ System.out.println(ex);
+ }
+ builder.build();
+ }
+
+ public static void main(String[] args) throws FileNotFoundException, IOException {
+ (new Test()).yah();
+ }
+}