Skip to content

Commit

Permalink
Implemented actual reading of CDK/N3 files
Browse files Browse the repository at this point in the history
Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Jun 25, 2011
1 parent b11336a commit f06dcb6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/org/openscience/cdk/io/rdf/CDKOWLReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
import org.openscience.cdk.io.DefaultChemObjectReader;
import org.openscience.cdk.io.formats.CDKOWLFormat;
import org.openscience.cdk.io.formats.IResourceFormat;
import org.openscience.cdk.libio.jena.Convertor;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;

/**
* Reads content from a CDK OWL serialization.
Expand Down Expand Up @@ -110,9 +114,15 @@ public <T extends IChemObject> T read(T object) throws CDKException {
throw new CDKException(
"Only supported is reading of IMolecule objects."
);
IMolecule result = (IMolecule)object;

// do the actual parsing
return object;
Model model = ModelFactory.createDefaultModel();
model.read(input, "", "N3");

IMolecule mol = Convertor.model2Molecule(model, object.getBuilder());
result.add(mol);
return (T)result;
}

/** {@inheritDoc} */
Expand Down

0 comments on commit f06dcb6

Please sign in to comment.