use of org.openscience.cdk.tools.ILoggingTool in project cdk by cdk.
the class OWLFile method unmarshal.
public static Entry unmarshal(Element entry, String ownNS) {
ILoggingTool logger = LoggingToolFactory.createLoggingTool(OWLFile.class);
// create a new entry by ID
Attribute id = entry.getAttribute("ID", rdfNS);
logger.debug("ID: ", id);
Entry dbEntry = new Entry(id.getValue());
// set additional, optional data
Element label = entry.getFirstChildElement("label", rdfsNS);
logger.debug("label: ", label);
if (label != null)
dbEntry.setLabel(label.getValue());
dbEntry.setClassName(entry.getQualifiedName());
logger.debug("class name: ", dbEntry.getClassName());
Element definition = entry.getFirstChildElement("definition", ownNS);
if (definition != null) {
dbEntry.setDefinition(definition.getValue());
}
Element description = entry.getFirstChildElement("description", ownNS);
if (description != null) {
dbEntry.setDescription(description.getValue());
}
if (entry.getQualifiedName().equals("Descriptor"))
dbEntry.setRawContent(entry);
return dbEntry;
}
use of org.openscience.cdk.tools.ILoggingTool in project cdk by cdk.
the class OWLReact method unmarshal.
public static EntryReact unmarshal(Element entry, String ownNS) {
ILoggingTool logger = LoggingToolFactory.createLoggingTool(OWLReact.class);
// create a new entry by ID
Attribute id = entry.getAttribute("ID", rdfNS);
logger.debug("ID: ", id);
EntryReact dbEntry = new EntryReact(id.getValue());
// set additional, optional data
Element label = entry.getFirstChildElement("label", rdfsNS);
logger.debug("label: ", label);
if (label != null)
dbEntry.setLabel(label.getValue());
dbEntry.setClassName(entry.getQualifiedName());
logger.debug("class name: ", dbEntry.getClassName());
Element definition = entry.getFirstChildElement("definition", ownNS);
if (definition != null) {
dbEntry.setDefinition(definition.getValue());
logger.debug("definition name: ", definition.getValue());
}
Element description = entry.getFirstChildElement("description", ownNS);
if (description != null) {
dbEntry.setDescription(description.getValue());
logger.debug("description name: ", description.getValue());
}
Elements representations = entry.getChildElements("representation", ownNS);
if (representations != null)
for (int i = 0; i < representations.size(); i++) {
// String idRepr = representations.get(i).getAttributeValue("id");
String contentRepr = representations.get(i).getAttributeValue("content");
dbEntry.setRepresentation(contentRepr);
}
Elements params = entry.getChildElements("parameters", ownNS);
if (params != null)
for (int i = 0; i < params.size(); i++) {
String typeParam = params.get(i).getAttributeValue("dataType");
typeParam = typeParam.substring(typeParam.indexOf(':') + 1, typeParam.length());
String nameParam = params.get(i).getAttributeValue("resource");
String value = params.get(i).getValue();
dbEntry.setParameters(nameParam, typeParam, value);
}
Elements paramsList = entry.getChildElements("parameterList", ownNS);
if (paramsList != null)
for (int i = 0; i < paramsList.size(); i++) {
Elements params2 = paramsList.get(i).getChildElements("parameter2", ownNS);
if (params2 != null)
for (int j = 0; j < params2.size(); j++) {
String paramClass = params2.get(i).getAttribute(0).getValue();
paramClass = paramClass.substring(paramClass.indexOf('#') + 1);
logger.debug("parameter class: ", paramClass);
String needsToSet = "";
String value = "";
String dataType = "";
Elements paramSubt1 = params2.get(i).getChildElements("isSetParameter", ownNS);
if (paramSubt1 != null)
for (int k = 0; k < 1; k++) needsToSet = paramSubt1.get(k).getValue();
Elements paramSubt2 = params2.get(i).getChildElements("value", ownNS);
if (paramSubt1 != null)
for (int k = 0; k < 1; k++) {
value = paramSubt2.get(k).getValue();
dataType = paramSubt2.get(k).getAttributeValue("dataType");
dataType = dataType.substring(dataType.indexOf(':') + 1, dataType.length());
}
List<String> pp = new ArrayList<>();
pp.add(paramClass);
pp.add(needsToSet);
pp.add(dataType);
pp.add(value);
dbEntry.addParameter(pp);
}
}
Elements mechanismDependence = entry.getChildElements("mechanismDependence", ownNS);
String mechanism = "";
if (mechanismDependence != null)
for (int i = 0; i < mechanismDependence.size(); i++) {
mechanism = mechanismDependence.get(i).getAttribute(0).getValue();
mechanism = mechanism.substring(mechanism.indexOf('#') + 1);
logger.debug("mechanism name: ", mechanism);
}
dbEntry.setMechanism(mechanism);
// System.out.println("mechan: "+mechan);
Elements exampleReact = entry.getChildElements("example-Reactions", ownNS);
if (exampleReact != null)
for (int i = 0; i < exampleReact.size(); i++) {
Elements reaction = exampleReact.get(i).getChildElements("reaction", ownNS);
if (reaction != null)
for (int j = 0; j < reaction.size(); j++) {
dbEntry.addExampleReaction(reaction.get(0).toXML());
}
}
return dbEntry;
}
use of org.openscience.cdk.tools.ILoggingTool in project cdk by cdk.
the class AbstractLoggingToolTest method testDebug_Object_Object_Object_Object.
@Test
public void testDebug_Object_Object_Object_Object() throws Exception {
ILoggingTool logger = getLoggingTool();
logger.debug(this, this, this, this);
}
use of org.openscience.cdk.tools.ILoggingTool in project cdk by cdk.
the class AbstractLoggingToolTest method testInfo_Object_boolean.
@Test
public void testInfo_Object_boolean() throws Exception {
ILoggingTool logger = getLoggingTool();
logger.info(this, true);
}
use of org.openscience.cdk.tools.ILoggingTool in project cdk by cdk.
the class AbstractLoggingToolTest method testDumpClasspath.
@Test
public void testDumpClasspath() throws Exception {
ILoggingTool logger = getLoggingTool();
logger.dumpClasspath();
}
Aggregations