Permalink
Browse files

Added missing JavaDoc for the iordf module

  • Loading branch information...
1 parent 2bf085f commit 0f22ddb111f5d836ed491abedcfb083f6d38389f @egonw egonw committed Mar 26, 2010
@@ -48,14 +48,27 @@
private Reader input;
+ /**
+ * Creates a new CDKOWLReader sending output to the given Writer.
+ *
+ * @param input {@link Reader} from which is OWL input is taken.
+ */
public CDKOWLReader(Reader input) {
this.input = input;
}
+ /**
+ * Creates a new CDKOWLReader with an undefined input.
+ */
public CDKOWLReader() {
this.input = null;
}
+ /**
+ * Returns the {@link IResourceFormat} for this reader.
+ *
+ * @return returns a {@link CDKOWLFormat}.
+ */
@TestMethod("testGetFormat")
public IResourceFormat getFormat() {
return CDKOWLFormat.getInstance();
@@ -64,17 +77,22 @@ public IResourceFormat getFormat() {
/**
* This method must not be used; XML reading requires the use of an
* {@link InputStream}. Use {@link #setReader(InputStream)} instead.
+ *
+ * @param reader reader to which should be written.
+ * @deprecated
*/
@TestMethod("testSetReader_Reader")
public void setReader(Reader reader) throws CDKException {
this.input = reader;
}
+ /** {@inheritDoc} */
@TestMethod("testSetReader_InputStream")
public void setReader(InputStream input) throws CDKException {
this.input = new InputStreamReader(input);
}
+ /** {@inheritDoc} */
@TestMethod("testAccepts")
public boolean accepts(Class classObject) {
Class[] interfaces = classObject.getInterfaces();
@@ -86,6 +104,7 @@ public boolean accepts(Class classObject) {
return false;
}
+ /** {@inheritDoc} */
public IChemObject read(IChemObject object) throws CDKException {
if (object instanceof IMolecule) {
return readMolecule((IMolecule)object);
@@ -102,6 +121,7 @@ private IMolecule readMolecule(IMolecule mol) throws CDKException {
return mol;
}
+ /** {@inheritDoc} */
@TestMethod("testClose")
public void close() throws IOException {
input.close();
@@ -61,7 +61,9 @@ public CDKOWLWriter() {
}
/**
- * Returns the {@link IResourceFormat} for this writer: {@link CDKOWLFormat}.
+ * Returns the {@link IResourceFormat} for this writer.
+ *
+ * @return returns a {@link CDKOWLFormat}.
*/
public IResourceFormat getFormat() {
return CDKOWLFormat.getInstance();
@@ -25,9 +25,14 @@
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
+import com.hp.hpl.jena.vocabulary.RDF;
/**
+ * Helper class to provide a Java API to the CDK OWL ontology, following the design of similar namespace
+ * classes in the Jena library, like {@link RDF}.
+ *
* @cdk.module iordf
+ * @cdk.githash
*/
public class CDK {
@@ -61,6 +61,12 @@
*/
public class Convertor {
+ /**
+ * Converts a {@link IMolecule} into a {@link Model} representation using the CDK OWL.
+ *
+ * @param molecule {@link IMolecule} to serialize into a RDF graph.
+ * @return the RDF graph representing the {@link IMolecule}.
+ */
public static Model molecule2Model(IMolecule molecule) {
Model model = createCDKModel();
Resource subject = model.createResource(
@@ -276,6 +282,12 @@ private static void deserializeIsotopeFields(Resource rdfObject,
isotope.setNaturalAbundance(naturalAbundance.getDouble());
}
+ /**
+ * Converts a {@link Resource} object into the matching {@link Order}.
+ *
+ * @param rdfOrder Resource for which the matching {@link Order} should be given.
+ * @return the matching {@link Order}.
+ */
public static Order resource2Order(Resource rdfOrder) {
if (rdfOrder.equals(CDK.SINGLEBOND)) {
return Order.SINGLE;
@@ -289,6 +301,12 @@ public static Order resource2Order(Resource rdfOrder) {
return null;
}
+ /**
+ * Create the {@link Resource} matching the given {@link Order}.
+ *
+ * @param order bond order to return the matching {@link Resource} for.
+ * @return the matching {@link Resource}.
+ */
public static Resource order2Resource(Order order) {
if (order == Order.SINGLE) {
return CDK.SINGLEBOND;
@@ -319,6 +337,13 @@ private static void deserializeElectronContainerFields(
bond.setElectronCount(count.getInt());
}
+ /**
+ * Converts a {@link Model} into an {@link IMolecule} using the given {@link IChemObjectBuilder}.
+ *
+ * @param model RDF graph to deserialize into an {@link IMolecule}.
+ * @param builder {@link IChemObjectBuilder} used to create new {@link IChemObject}s.
+ * @return a {@link IMolecule} deserialized from the RDF graph.
+ */
public static IMolecule model2Molecule(Model model,
IChemObjectBuilder builder) {
ResIterator mols =

0 comments on commit 0f22ddb

Please sign in to comment.