petermr avatar petermr committed a683af1

fixed poms

Comments (0)

Files changed (3)

         <version>0.3-SNAPSHOT</version>
     </parent>
 
-   <artifactId>jumbo-converters-reaction</artifactId>
-
-   <name>jumbo-converters-reaction</name>
+   <artifactId>jc-reaction</artifactId>
+   <name>jc-reaction</name>
 
    <dependencies>
+        <dependency>
+            <groupId>${jumbo.groupId}</groupId>
+            <artifactId>jumbo</artifactId>
+            <version>${jumbo.version}</version>
+        </dependency>
       <dependency>
          <groupId>cml</groupId>
-         <artifactId>jumbo-converters-core</artifactId>
-      </dependency>
-      <dependency>
-         <groupId>cml</groupId>
-         <artifactId>jumbo-converters-rdf</artifactId>
+         <artifactId>jc-top-core</artifactId>
+         <version>${project.version}</version>
       </dependency>
       <dependency>
          <groupId>${cml.groupId}</groupId>

src/main/java/org/xmlcml/cml/converters/reaction/properties/CMLRDFObject.java

 import org.apache.log4j.Logger;
 import org.xmlcml.cml.base.CMLConstants;
 import org.xmlcml.cml.base.CMLElement;
-import org.xmlcml.cml.converters.rdf.rdf.RDFDescription;
-import org.xmlcml.cml.converters.rdf.rdf.RDFRdf;
-import org.xmlcml.cml.converters.rdf.rdf.RDFTriple;
 import org.xmlcml.cml.converters.reaction.properties.MMReConstants.Predicate;
 import org.xmlcml.cml.converters.reaction.properties.MMReConstants.Unit;
 import org.xmlcml.cml.element.CMLAction;
 public class CMLRDFObject {
 	private static Logger LOG = Logger.getLogger(CMLRDFObject.class);
 	
-	private RDFRdf rdf;
-	
-	public CMLRDFObject(RDFRdf rdf) {
-		this.rdf = rdf;
-	}
+//	private RDFRdf rdf;
+//	
+//	public CMLRDFObject(RDFRdf rdf) {
+//		this.rdf = rdf;
+//	}
 	
 /**
 		HAS_MASS("hasGram"),
 		HAS_VALUE("hasValue"),
  */	
 	
-	public void expandDescription(RDFDescription description, CMLElement element) {
-		if (element == null) {
-			throw new RuntimeException("NULL");
-		}
-		element.setId(description.getId());
-		for (RDFTriple triple : description.getTripleList()) {
-			expandTriple(triple, element);
-		}
-	}
+//	public void expandDescription(RDFDescription description, CMLElement element) {
+//		if (element == null) {
+//			throw new RuntimeException("NULL");
+//		}
+//		element.setId(description.getId());
+//		for (RDFTriple triple : description.getTripleList()) {
+//			expandTriple(triple, element);
+//		}
+//	}
 
 	/**
 	 * triple can either have resource pointer or content
 	 * @param element
 	 * @param triple
 	 */
-	public void expandTriple(RDFTriple triple, CMLElement element) {
-		RDFDescription resourceDescription = triple.getResourceDescription(rdf);
-		CMLElement newElement = createCMLElement(triple, element);
-		if (newElement == null) {
-			LOG.trace("null element "+triple.getLocalName());
-		} else {
-			element.appendChild(newElement);
-			String id = triple.getResourceId();
-			if (id != null) {
-				newElement.addAttribute(new Attribute("ref", id));
-			}
-			String content = triple.getContent();
-			if (resourceDescription != null) {
-				expandDescription(resourceDescription, newElement);
-			} else if (content != null) {
-				// leaf node
-				newElement.appendChild(content);
-				String dataType = triple.getDatatype();
-				if (dataType != null) {
-					newElement.addAttribute(new Attribute("dataType", dataType));
-				}
-				removeTemporaryRefAttribute(newElement);
-			} else if (id != null) {
-				// leave an empty pointer
-			} else {
-				// leave empty element
-				LOG.warn("No resource pointer/Id or content "+triple);
-			}
-			// remove ref from parent
-		}
-		removeTemporaryRefAttribute(element);
-	}
+//	public void expandTriple(RDFTriple triple, CMLElement element) {
+//		RDFDescription resourceDescription = triple.getResourceDescription(rdf);
+//		CMLElement newElement = createCMLElement(triple, element);
+//		if (newElement == null) {
+//			LOG.trace("null element "+triple.getLocalName());
+//		} else {
+//			element.appendChild(newElement);
+//			String id = triple.getResourceId();
+//			if (id != null) {
+//				newElement.addAttribute(new Attribute("ref", id));
+//			}
+//			String content = triple.getContent();
+//			if (resourceDescription != null) {
+//				expandDescription(resourceDescription, newElement);
+//			} else if (content != null) {
+//				// leaf node
+//				newElement.appendChild(content);
+//				String dataType = triple.getDatatype();
+//				if (dataType != null) {
+//					newElement.addAttribute(new Attribute("dataType", dataType));
+//				}
+//				removeTemporaryRefAttribute(newElement);
+//			} else if (id != null) {
+//				// leave an empty pointer
+//			} else {
+//				// leave empty element
+//				LOG.warn("No resource pointer/Id or content "+triple);
+//			}
+//			// remove ref from parent
+//		}
+//		removeTemporaryRefAttribute(element);
+//	}
 
 	private void removeTemporaryRefAttribute(CMLElement element) {
 		String ref = element.getAttributeValue("ref");
 		}
 	}
 	
-	public CMLElement createCMLElement(RDFTriple triple, CMLElement element) {
-		CMLElement newElement = null;
-		String localName = triple.getLocalName();
-		String content = triple.getContent();
-		Predicate predicate = Predicate.getPredicate(localName);
-		if (predicate == null) {
-			throw new RuntimeException("Unknown predicate: "+localName);
-
-		} else if (
-			predicate.equals(Predicate.HAS_MASS) ||
-			predicate.equals(Predicate.HAS_VOL) ||
-			predicate.equals(Predicate.HAS_MOLAR_AMOUNT) ||
-			predicate.equals(Predicate.HAS_PERCENT)) {
-			newElement = new CMLScalar();
-			if (predicate.dictRef != null) {
-				newElement.addAttribute(new Attribute("dictRef", predicate.dictRef));
-			}
-			newElement.addAttribute(new Attribute("dataType", CMLConstants.XSD_DOUBLE));
-			
-		} else if (predicate.equals(Predicate.HAS_AMOUNT)) {
-			newElement = new CMLAmount();
-			
-		} else if (
-			predicate.equals(Predicate.HAS_COLOR) ||
-			predicate.equals(Predicate.HAS_STATE)) {
-			newElement = new CMLProperty();
-			if (predicate.dictRef != null) {
-				newElement.addAttribute(new Attribute("dictRef", predicate.dictRef));
-			}
-		} else if (
-				predicate.equals(Predicate.IS_CONCENTRATED_BY) ||
-				predicate.equals(Predicate.IS_PURIFIED_BY) ||
-				predicate.equals(Predicate.IS_WASHED_BY) ||
-				predicate.equals(Predicate.HAS_CHROMATOGRAPHY) ||
-				predicate.equals(Predicate.IS_EXTRACTED_BY) ||
-				predicate.equals(Predicate.HAS_FILTER_PHRASE) ||
-				predicate.equals(Predicate.IS_FILTERED_BY)) {
-			newElement = new CMLAction();
-			if (predicate.dictRef != null) {
-				newElement.addAttribute(new Attribute("role", predicate.dictRef));
-			}
-		} else if (predicate.equals(Predicate.HAS_NAME)) {
-			newElement = new CMLName();
-		} else if (predicate.equals(Predicate.HAS_NUMBER)) {
-			newElement = new CMLLabel();
-			if (predicate.dictRef != null) {
-				newElement.addAttribute(new Attribute("role", predicate.dictRef));
-			}
-		} else if (predicate.equals(Predicate.HAS_PREPARATION)) {
-			newElement = new CMLReaction();
-		} else if (predicate.equals(Predicate.HAS_PRODUCT)) {
-			newElement = new CMLProduct();
-		} else if (predicate.equals(Predicate.HAS_REACTANT)) {
-			newElement = new CMLReactant();
-		} else if (predicate.equals(Predicate.HAS_ROLE)) {
-			element.addAttribute(new Attribute("role", content));
-		} else if (predicate.equals(Predicate.HAS_SUBSTANCE)) {
-			newElement = new CMLSubstance();
-		} else if (
-				predicate.equals(Predicate.HAS_PRESSURE) ||
-				predicate.equals(Predicate.HAS_TIME) ||
-				predicate.equals(Predicate.HAS_TEMP)
-				) {
-			newElement = new CMLParameter();
-			if (predicate.dictRef != null) {
-				newElement.addAttribute(new Attribute("dictRef", predicate.dictRef));
-			}
-			newElement.addAttribute(new Attribute("dataType", CMLConstants.XSD_DOUBLE));
-
-		} else if (predicate.equals(Predicate.HAS_UNIT)) {
-			content = RDFRdf.translateChars(content);
-			Unit unit = MMReConstants.UNIT_MAP.get(content);
-			if (unit == null) {
-				throw new RuntimeException("unknown unit: "+content);
-			}
-			element.addAttribute(new Attribute(MMReConstants.UNIT_ATTNAME, unit.value));
-
-		} else if (predicate.equals(Predicate.HAS_VALUE)) {
-			element.addAttribute(new Attribute("value", content));
-		} else {
-			throw new RuntimeException("unknown predicate "+predicate);
-		}
-		return newElement;
-	}
+//	public CMLElement createCMLElement(RDFTriple triple, CMLElement element) {
+//		CMLElement newElement = null;
+//		String localName = triple.getLocalName();
+//		String content = triple.getContent();
+//		Predicate predicate = Predicate.getPredicate(localName);
+//		if (predicate == null) {
+//			throw new RuntimeException("Unknown predicate: "+localName);
+//
+//		} else if (
+//			predicate.equals(Predicate.HAS_MASS) ||
+//			predicate.equals(Predicate.HAS_VOL) ||
+//			predicate.equals(Predicate.HAS_MOLAR_AMOUNT) ||
+//			predicate.equals(Predicate.HAS_PERCENT)) {
+//			newElement = new CMLScalar();
+//			if (predicate.dictRef != null) {
+//				newElement.addAttribute(new Attribute("dictRef", predicate.dictRef));
+//			}
+//			newElement.addAttribute(new Attribute("dataType", CMLConstants.XSD_DOUBLE));
+//			
+//		} else if (predicate.equals(Predicate.HAS_AMOUNT)) {
+//			newElement = new CMLAmount();
+//			
+//		} else if (
+//			predicate.equals(Predicate.HAS_COLOR) ||
+//			predicate.equals(Predicate.HAS_STATE)) {
+//			newElement = new CMLProperty();
+//			if (predicate.dictRef != null) {
+//				newElement.addAttribute(new Attribute("dictRef", predicate.dictRef));
+//			}
+//		} else if (
+//				predicate.equals(Predicate.IS_CONCENTRATED_BY) ||
+//				predicate.equals(Predicate.IS_PURIFIED_BY) ||
+//				predicate.equals(Predicate.IS_WASHED_BY) ||
+//				predicate.equals(Predicate.HAS_CHROMATOGRAPHY) ||
+//				predicate.equals(Predicate.IS_EXTRACTED_BY) ||
+//				predicate.equals(Predicate.HAS_FILTER_PHRASE) ||
+//				predicate.equals(Predicate.IS_FILTERED_BY)) {
+//			newElement = new CMLAction();
+//			if (predicate.dictRef != null) {
+//				newElement.addAttribute(new Attribute("role", predicate.dictRef));
+//			}
+//		} else if (predicate.equals(Predicate.HAS_NAME)) {
+//			newElement = new CMLName();
+//		} else if (predicate.equals(Predicate.HAS_NUMBER)) {
+//			newElement = new CMLLabel();
+//			if (predicate.dictRef != null) {
+//				newElement.addAttribute(new Attribute("role", predicate.dictRef));
+//			}
+//		} else if (predicate.equals(Predicate.HAS_PREPARATION)) {
+//			newElement = new CMLReaction();
+//		} else if (predicate.equals(Predicate.HAS_PRODUCT)) {
+//			newElement = new CMLProduct();
+//		} else if (predicate.equals(Predicate.HAS_REACTANT)) {
+//			newElement = new CMLReactant();
+//		} else if (predicate.equals(Predicate.HAS_ROLE)) {
+//			element.addAttribute(new Attribute("role", content));
+//		} else if (predicate.equals(Predicate.HAS_SUBSTANCE)) {
+//			newElement = new CMLSubstance();
+//		} else if (
+//				predicate.equals(Predicate.HAS_PRESSURE) ||
+//				predicate.equals(Predicate.HAS_TIME) ||
+//				predicate.equals(Predicate.HAS_TEMP)
+//				) {
+//			newElement = new CMLParameter();
+//			if (predicate.dictRef != null) {
+//				newElement.addAttribute(new Attribute("dictRef", predicate.dictRef));
+//			}
+//			newElement.addAttribute(new Attribute("dataType", CMLConstants.XSD_DOUBLE));
+//
+//		} else if (predicate.equals(Predicate.HAS_UNIT)) {
+//			content = RDFRdf.translateChars(content);
+//			Unit unit = MMReConstants.UNIT_MAP.get(content);
+//			if (unit == null) {
+//				throw new RuntimeException("unknown unit: "+content);
+//			}
+//			element.addAttribute(new Attribute(MMReConstants.UNIT_ATTNAME, unit.value));
+//
+//		} else if (predicate.equals(Predicate.HAS_VALUE)) {
+//			element.addAttribute(new Attribute("value", content));
+//		} else {
+//			throw new RuntimeException("unknown predicate "+predicate);
+//		}
+//		return newElement;
+//	}
 }

src/main/java/org/xmlcml/cml/converters/reaction/properties/MMReConstants.java

 
 import nu.xom.XPathContext;
 
-import org.xmlcml.cml.converters.rdf.rdf.RDFConstants;
-
 public class MMReConstants {
 
 	public final static String MICRO = "&#956;";
 	static {
 		UNIT_MAP.put("ml", Unit.MILLILITRE);
 		UNIT_MAP.put("mL", Unit.MILLILITRE);
-		UNIT_MAP.put("�L", Unit.MICROLITRE);
+		UNIT_MAP.put("�L", Unit.MICROLITRE);
 		UNIT_MAP.put(MICRO+"L", Unit.MICROLITRE);
 		UNIT_MAP.put(MICRO+"l", Unit.MICROLITRE);
 		
 	
 	public final static String MMRE_NS = "http://www.polymerinformatics.com/RecipeRepository.owl#";
 	public final static XPathContext MMRE_XPATH= new XPathContext("mmre", MMRE_NS);
-	public final static XPathContext RDF_MMRE_XPATH = new XPathContext("rdf", RDFConstants.RDF_NS);
-	static {
-		RDF_MMRE_XPATH.addNamespace("mmre", MMRE_NS);
-	};
 	
 
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.