File directory = componentDirectory.getDirectory();
directory.mkdirs();
// writeMetaInf(directory, componentDirectory.getNode(),
// METAMODEL.FunctionallyGroundedNode, functionallyGroundedNode);
File metaInfFile = new File(directory, "meta-inf");
Model metaInfModel = ModelFactory.createDefaultModel();
Resource componentRes = metaInfModel
.createResource(componentDirectory.getNode().getURIRef());
componentRes.addProperty(RDF.type,
METAMODEL.FunctionallyGroundedNode);
componentRes.addProperty(METAMODEL.hashCode, metaInfModel
.createTypedLiteral(functionallyGroundedNode.hashCode()));
componentRes.addProperty(METAMODEL.strongHashCode, metaInfModel
.createTypedLiteral(functionallyGroundedNode
.strongHashCode()));
for (NonTerminalMolecule molecule : functionallyGroundedNode
.getGroundingMolecules()) {
// storeNTMolecule doesn't add duplicate
NamedNode moleculeName;
try {
moleculeName = storeNTMolecule(molecule);
} catch (IOException e) {
throw new RuntimeException(e);
}
componentRes.addProperty(METAMODEL.containsNonTerminalMolecule,
metaInfModel.createResource(moleculeName.getURIRef()));
}
OutputStream metaInfOut = new FileOutputStream(metaInfFile);
try {
metaInfModel.write(metaInfOut, "N-TRIPLE");
} finally {
metaInfOut.close();
}
indexModel.add(metaInfModel);
result = componentDirectory.node;