use of org.apache.jena.riot.process.inf.InferenceSetupRDFS in project jena by apache.
the class CmdLangParse method exec$.
protected void exec$() {
if (modLangParse.getRDFSVocab() != null)
setup = new InferenceSetupRDFS(modLangParse.getRDFSVocab());
if (modLangOutput.compressedOutput()) {
try {
outputWrite = new GZIPOutputStream(outputWrite, true);
} catch (IOException e) {
IO.exception(e);
}
}
outputStream = null;
PostParseHandler postParse = null;
outputStream = createStreamSink();
if (outputStream == null) {
Pair<StreamRDF, PostParseHandler> p = createAccumulateSink();
outputStream = p.getLeft();
postParse = p.getRight();
}
try {
// The actual parsing ...
if (super.getPositional().isEmpty()) {
ParseRecord parseRec = parseFile("-");
outcome(parseRec);
} else {
boolean b = super.getPositional().size() > 1;
for (String fn : super.getPositional()) {
if (b && !super.isQuiet())
SysRIOT.getLogger().info("File: " + fn);
ParseRecord parseRec = parseFile(fn);
outcome(parseRec);
}
}
if (postParse != null)
postParse.postParse();
// Total if more than one file.
if (super.getPositional().size() > 1 && modTime.timingEnabled()) {
long totalMillis = 0;
long totalTriples = 0;
long totalQuads = 0;
long totalTuples = 0;
boolean allSuccessful = true;
for (ParseRecord pRec : outcomes) {
if (pRec.timeMillis >= 0)
totalMillis += pRec.timeMillis;
totalTriples += pRec.triples;
totalQuads += pRec.quads;
totalTuples += pRec.tuples;
allSuccessful = allSuccessful & pRec.success;
}
output("Total", true, totalTriples, totalQuads, totalTuples, totalMillis);
}
} finally {
if (outputWrite != System.out)
IO.close(outputWrite);
else
IO.flush(outputWrite);
System.err.flush();
}
// exit(1) if there were any errors.
for (ParseRecord pr : outcomes) {
if (!pr.success)
throw new CmdException();
}
}
Aggregations