use of ambit2.core.processors.structure.key.PropertyKey in project ambit-mirror by ideaconsult.
the class PropertyImporter method setPropertyKey.
public void setPropertyKey(IStructureKey propertyKey) {
this.queryKey = propertyKey;
if ((propertyKey instanceof SmilesKey) || (propertyKey instanceof InchiKey)) {
query_property = new QueryStructure();
} else if ((propertyKey.getType() == Number.class) || (propertyKey.getType() == Integer.class) || (propertyKey.getType() == Double.class))
query_property = new QueryFieldNumeric();
else
query_property = new QueryField();
query_property.setId(-1);
}
use of ambit2.core.processors.structure.key.PropertyKey in project ambit-mirror by ideaconsult.
the class RepositoryWriterToXMLTest method write.
public int write(IRawReader<IStructureRecord> reader, Connection connection, PropertyKey key) throws Exception {
RepositoryWriter writer = new RepositoryWriter();
if (key != null)
writer.setPropertyKey(key);
writer.setDataset(new SourceDataset("TEST INPUT", LiteratureEntry.getInstance("File", "file:study.toxml")));
writer.setConnection(connection);
writer.open();
int records = 0;
while (reader.hasNext()) {
IStructureRecord record = reader.nextRecord();
writer.write(record);
records++;
}
reader.close();
writer.close();
return records;
}
use of ambit2.core.processors.structure.key.PropertyKey in project ambit-mirror by ideaconsult.
the class SubstanceWriterTest method write.
public int write(SubstanceEndpointsBundle bundle, IRawReader<IStructureRecord> reader, Connection connection, PropertyKey key, boolean splitRecord, boolean clearMeasurements, boolean clearComposition) throws Exception {
DBSubstanceWriter writer;
if (bundle != null)
writer = new DBBundleStudyWriter(bundle, DBSubstanceWriter.datasetMeta(), new SubstanceRecord());
else
writer = new DBSubstanceWriter(DBSubstanceWriter.datasetMeta(), new SubstanceRecord(), clearMeasurements, clearComposition);
writer.setSplitRecord(splitRecord);
writer.setConnection(connection);
writer.open();
int records = 0;
while (reader.hasNext()) {
Object record = reader.next();
if (record == null)
continue;
Assert.assertTrue(record instanceof IStructureRecord);
if (record instanceof SubstanceRecord)
writer.setImportedRecord((SubstanceRecord) record);
writer.process((IStructureRecord) record);
records++;
}
writer.close();
return records;
}
use of ambit2.core.processors.structure.key.PropertyKey in project ambit-mirror by ideaconsult.
the class RepositoryWriterTest method write.
public int write(IRawReader<IStructureRecord> reader, Connection connection, PropertyKey key, boolean useExistingStructure, int maxrecords) throws Exception {
RepositoryWriter writer = new RepositoryWriter();
writer.setUseExistingStructure(useExistingStructure);
if (key != null)
writer.setPropertyKey(key);
writer.setDataset(new SourceDataset("TEST INPUT", LiteratureEntry.getInstance("File", "file:input.sdf")));
writer.setConnection(connection);
writer.open();
int records = 0;
while (reader.hasNext()) {
IStructureRecord record = reader.nextRecord();
writer.write(record);
records++;
if (maxrecords <= 0 || (records <= maxrecords))
continue;
else
break;
}
reader.close();
writer.close();
return records;
}
use of ambit2.core.processors.structure.key.PropertyKey in project ambit-mirror by ideaconsult.
the class NanoWriterTest method write.
public int write(IRawReader<IStructureRecord> reader, Connection connection, PropertyKey key) throws Exception {
RepositoryWriter writer = new RepositoryWriter();
if (key != null)
writer.setPropertyKey(key);
writer.setDataset(new SourceDataset("TEST INPUT", LiteratureEntry.getInstance("File", "file:input.nmx")));
writer.setConnection(connection);
writer.open();
int records = 0;
while (reader.hasNext()) {
IStructureRecord record = reader.nextRecord();
writer.write(record);
records++;
}
reader.close();
writer.close();
return records;
}
Aggregations