Permalink
Browse files

Reuse of earlier extracted helper methods

  • Loading branch information...
1 parent 8b2e4c2 commit f78e0d1440678da3b223e90671a7e45fbdfac8e0 @egonw egonw committed Oct 8, 2009
Showing with 6 additions and 17 deletions.
  1. +6 −17 src/main/org/openscience/cdk/libio/jena/Convertor.java
@@ -82,14 +82,11 @@ public static Model molecule2Model(IMolecule molecule) {
for (IAtom atom : bond.atoms()) {
model.add(rdfBond, CDK.bindsAtom, cdkToRDFAtomMap.get(atom));
}
- if (bond.getOrder() == IBond.Order.SINGLE) {
- model.add(rdfBond, CDK.hasOrder, CDK.SingleBond);
- } else if (bond.getOrder() == IBond.Order.DOUBLE) {
- model.add(rdfBond, CDK.hasOrder, CDK.DoubleBond);
- } else if (bond.getOrder() == IBond.Order.TRIPLE) {
- model.add(rdfBond, CDK.hasOrder, CDK.TripleBond);
- } else if (bond.getOrder() == IBond.Order.QUADRUPLE) {
- model.add(rdfBond, CDK.hasOrder, CDK.QuadrupleBond);
+ if (bond.getOrder() != null) {
+ model.add(
+ rdfBond, CDK.hasOrder,
+ order2Resource(bond.getOrder())
+ );
}
model.add(subject, CDK.hasBond, rdfBond);
}
@@ -274,15 +271,7 @@ public static IMolecule model2Molecule(Model model,
}
Resource order = rdfBond.
getProperty(CDK.hasOrder).getResource();
- if (order.equals(CDK.SingleBond)) {
- bond.setOrder(IBond.Order.SINGLE);
- } else if (order.equals(CDK.DoubleBond)) {
- bond.setOrder(IBond.Order.DOUBLE);
- } else if (order.equals(CDK.TripleBond)) {
- bond.setOrder(IBond.Order.TRIPLE);
- } else if (order.equals(CDK.QuadrupleBond)) {
- bond.setOrder(IBond.Order.QUADRUPLE);
- }
+ bond.setOrder(resource2Order(order));
mol.addBond(bond);
}
}

0 comments on commit f78e0d1

Please sign in to comment.