本文整理汇总了Java中gov.nih.nci.cagrid.cqlquery.CQLQuery类的典型用法代码示例。如果您正苦于以下问题:Java CQLQuery类的具体用法?Java CQLQuery怎么用?Java CQLQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CQLQuery类属于gov.nih.nci.cagrid.cqlquery包,在下文中一共展示了CQLQuery类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testQueryCdCodeNotNull
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
public void testQueryCdCodeNotNull() {
CQLQuery query = new CQLQuery();
gov.nih.nci.cagrid.cqlquery.Object target =
new gov.nih.nci.cagrid.cqlquery.Object();
target.setName(CdDataType.class.getName());
Association association1 = new Association();
association1.setName(Cd.class.getName());
association1.setRoleName("value1");
target.setAssociation(association1);
Attribute attribute2 = new Attribute();
attribute2.setName("code");
attribute2.setPredicate(Predicate.IS_NOT_NULL);
attribute2.setValue("true");
association1.setAttribute(attribute2);
query.setTarget(target);
Iterator<?> iter = executeQuery(query).iterator();
ArrayList<CdDataType> result = new ArrayList<CdDataType>();
while (iter.hasNext()) {
result.add((CdDataType)iter.next());
}
gov.nih.nci.cacoresdk.domain.other.datatype.CdDataType testResultClass = result.get(0);
assertEquals(5, result.size());
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:25,代码来源:Cql2IsoQueriesTestCase.java
示例2: testQueryPqUnit
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
public void testQueryPqUnit() {
CQLQuery query = new CQLQuery();
gov.nih.nci.cagrid.cqlquery.Object target = new gov.nih.nci.cagrid.cqlquery.Object();
target.setName(PqDataType.class.getName());
Association association1 = new Association();
association1.setName(Pq.class.getName());
association1.setRoleName("value1");
target.setAssociation(association1);
Attribute attribute2 = new Attribute();
attribute2.setName("unit");
attribute2.setPredicate(Predicate.IS_NOT_NULL);
association1.setAttribute(attribute2);
query.setTarget(target);
Iterator<?> iter = executeQuery(query).iterator();
ArrayList<gov.nih.nci.cacoresdk.domain.other.datatype.PqDataType> result = new ArrayList<gov.nih.nci.cacoresdk.domain.other.datatype.PqDataType>();
while (iter.hasNext()) {
result.add((gov.nih.nci.cacoresdk.domain.other.datatype.PqDataType) iter.next());
}
gov.nih.nci.cacoresdk.domain.other.datatype.PqDataType testResultClass = result.get(0);
assertEquals(5, result.size());
assertEquals("GALLON", testResultClass.getValue1().getUnit().toString());
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:24,代码来源:IsoQueriesTestCase.java
示例3: getImageSeriesAnnotation
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public ImageAnnotation getImageSeriesAnnotation(String seriesInstanceUID) throws ConnectionException {
ImageAnnotation imageAnnotation = null;
Attribute seriesInstanceUIDAttribute = retrieveAttribute("instanceUID", Predicate.EQUAL_TO, seriesInstanceUID);
Association seriesAssociation = retrieveAssociation("edu.northwestern.radiology.aim.Series", "series",
seriesInstanceUIDAttribute);
Association studyAssociation = retrieveAssociation("edu.northwestern.radiology.aim.Study", "study",
null);
Association dicomImageReferenceAssociation = retrieveAssociation(
"edu.northwestern.radiology.aim.DICOMImageReference", "imageReferenceCollection", null);
studyAssociation.setAssociation(seriesAssociation);
dicomImageReferenceAssociation.setAssociation(studyAssociation);
CQLQuery query = retrieveQuery("edu.northwestern.radiology.aim.ImageAnnotation",
dicomImageReferenceAssociation);
CQLQueryResults result = connectAndExecuteQuery(query);
if (result != null) {
CQLQueryResultsIterator iter = new CQLQueryResultsIterator(result, true);
if (iter.hasNext()) {
imageAnnotation = AIMJaxbParser.retrieveImageAnnotationFromXMLString((String) iter.next());
}
}
return imageAnnotation;
}
开发者ID:NCIP,项目名称:caintegrator,代码行数:26,代码来源:AIMSearchServiceImpl.java
示例4: addParameterValues
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
private void addParameterValues(ComputationJob job) throws RepositoryException {
if (job == null || job.getId() == null) {
throw new IllegalArgumentException("Job must not be null, and must have a valid id.") ;
}
CQLQuery query = newQuery().forObject(ParameterValue.class.getName()).with(
associationTo(ComputationJob.class.getName()).withRole("job").with(
attribute("id").equalTo(job.getId()))).build() ;
List<ParameterValue> values ;
try {
values = queryProcessor.processObjectQuery(query, ParameterValue.class) ;
} catch (QueryProcessingException e) {
throw new RepositoryException("Exception retrieving job's parameter values from repository.", e) ;
}
addParameterToValues(values) ;
job.setParameterValues(values) ;
}
开发者ID:NCIP,项目名称:digital-model-repository,代码行数:17,代码来源:AnzoCmefRepository.java
示例5: testCqlSearchWithAssociations
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
/**
* Tests searching for an entity using CQL, where the search involves associations.
*/
@Test
public void testCqlSearchWithAssociations() {
saveSupportingObjects();
CQLQuery cqlQuery = formulateCqlQueryWithAssociations();
Transaction tx = null;
try {
tx = hibernateHelper.beginTransaction();
List<?> matchingProtocols = SEARCH_DAO.query(cqlQuery);
assertEquals(1, matchingProtocols.size());
assertEquals(DUMMY_PROTOCOL_1, matchingProtocols.get(0));
tx.commit();
} catch (DAOException e) {
hibernateHelper.rollbackTransaction(tx);
fail("DAO exception during CQL search: " + e.getMessage());
}
}
开发者ID:NCIP,项目名称:caarray,代码行数:21,代码来源:SearchDaoTest.java
示例6: getQueryFromCql
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
/**
* This method takes in a target object, associated object name, associated object attribute name, and
* associated object attribute value. This method creates a CQL query that finds all records
* of the target objects restricted by the input associated object arguments.
*
* @param object The target object of the query
* @param args[0] The simple name of the associated object for the query
* @param args[1] The role name of the association
* @param args[2] The name of the attribute in the associated object to match on
* @param args[3] The value of the attribute in the associated object to match on
*/
@Override
public CQLQuery getQueryFromCql(CbmObject object, String... args) throws Exception {
String associatedObjectName = args[0];
String roleName = args[1];
String attributeName = args[2];
String attributeValue = args[3];
StringBuffer cql = new StringBuffer();
cql.append("<CQLQuery xmlns=\"http://CQL.caBIG/1/gov.nih.nci.cagrid.CQLQuery\">");
cql.append("<Target name=\"gov.nih.nci.cbm.domain.LogicalModel." + object.getSimpleName() + "\">");
cql.append("<Association roleName=\"" + roleName + "\" name=\"gov.nih.nci.cbm.domain.LogicalModel." + associatedObjectName + "\">");
cql.append("<Attribute name=\"" + attributeName + "\" value=\"" + attributeValue + "\" predicate=\"EQUAL_TO\"/>");
cql.append("</Association>");
cql.append("</Target>");
cql.append("</CQLQuery>");
String queryString = cql.toString();
CQLQuery query = (CQLQuery)gov.nih.nci.cagrid.common.Utils.deserializeObject(new StringReader(queryString), CQLQuery.class);
return query;
}
开发者ID:NCIP,项目名称:common-biorepository-model,代码行数:35,代码来源:RetrieveAssociationsQueryBuilder.java
示例7: testQueryIiRootAttribute
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
public void testQueryIiRootAttribute() {
CQLQuery query = new CQLQuery();
gov.nih.nci.cagrid.cqlquery.Object target = new gov.nih.nci.cagrid.cqlquery.Object();
target.setName(IiDataType.class.getName());
Association association1 = new Association();
association1.setName(Ii.class.getName());
association1.setRoleName("value2");
target.setAssociation(association1);
Attribute attribute2 = new Attribute();
attribute2.setName("root");
attribute2.setPredicate(Predicate.IS_NOT_NULL);
attribute2.setValue("true");
association1.setAttribute(attribute2);
query.setTarget(target);
Iterator<?> iter = executeQuery(query).iterator();
ArrayList<IiDataType> result = new ArrayList<IiDataType>();
while (iter.hasNext()) {
result.add((IiDataType) iter.next());
}
IiDataType testResultClass = result.get(0);
assertEquals(2, result.size());
assertEquals("II_VALUE2_ROOT", testResultClass.getValue2().getRoot().toString());
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:25,代码来源:IsoQueriesTestCase.java
示例8: testQueryAdxpAddressPartTypeADL
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
public void testQueryAdxpAddressPartTypeADL() {
CQLQuery query = new CQLQuery();
gov.nih.nci.cagrid.cqlquery.Object target = new gov.nih.nci.cagrid.cqlquery.Object();
target.setName(AdDataType.class.getName());
Association assoc1 = new Association();
assoc1.setName(Ad.class.getName());
assoc1.setRoleName("value1");
Association assoc2 = new Association();
assoc2.setName(Adxp.class.getName());
assoc2.setRoleName("part");
Attribute attrib = new Attribute("type", Predicate.EQUAL_TO, AddressPartType.ADL.name());
assoc2.setAttribute(attrib);
assoc1.setAssociation(assoc2);
target.setAssociation(assoc1);
query.setTarget(target);
executeQuery(query);
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:19,代码来源:IsoQueriesTestCase.java
示例9: retrieveAllImageAnnotations
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
List<ImageAnnotation> retrieveAllImageAnnotations() throws ConnectionException {
List<ImageAnnotation> imageAnnotations = new ArrayList<ImageAnnotation>();
final CQLQuery query = new CQLQuery();
Object target = new Object();
target.setName("edu.northwestern.radiology.aim.ImageAnnotation");
query.setTarget(target);
CQLQueryResults result = connectAndExecuteQuery(query);
if (result != null) {
CQLQueryResultsIterator iter2 = new CQLQueryResultsIterator(result);
while (iter2.hasNext()) {
imageAnnotations.add((ImageAnnotation) iter2.next());
}
}
return imageAnnotations;
}
开发者ID:NCIP,项目名称:caintegrator,代码行数:17,代码来源:AIMSearchServiceImpl.java
示例10: testQueryScDataType
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
public void testQueryScDataType() {
CQLQuery query = new CQLQuery();
gov.nih.nci.cagrid.cqlquery.Object target = new gov.nih.nci.cagrid.cqlquery.Object();
target.setName(ScDataType.class.getName());
Association assoc1 = new Association();
assoc1.setName(Sc.class.getName());
assoc1.setRoleName("value2");
Association assoc2 = new Association();
assoc2.setName(Cd.class.getName());
assoc2.setRoleName("code");
Attribute attrib = new Attribute("code", Predicate.EQUAL_TO, "VALUE2_CODE_CODE1");
assoc2.setAttribute(attrib);
assoc1.setAssociation(assoc2);
target.setAssociation(assoc1);
query.setTarget(target);
executeQuery(query);
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:19,代码来源:IsoQueriesTestCase.java
示例11: queryForInvalidClass
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
private void queryForInvalidClass(EnumerationDataServiceClient client) throws Exception {
CQLQuery query = new CQLQuery();
gov.nih.nci.cagrid.cqlquery.Object target = new gov.nih.nci.cagrid.cqlquery.Object();
target.setName("non.existant.class");
query.setTarget(target);
EnumerationResponseContainer enumContainer = null;
try {
enumContainer = client.enumerationQuery(query);
} catch (QueryProcessingExceptionType ex) {
assertTrue("Query Processing Exception Type thrown", true);
} finally {
if (enumContainer != null && enumContainer.getContext() != null) {
Release release = new Release();
release.setEnumerationContext(enumContainer.getContext());
createDataSource(enumContainer.getEPR()).releaseOp(release);
}
}
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:19,代码来源:InvokeEnumerationDataServiceStep.java
示例12: createCqlQuery
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
private CQLQuery createCqlQuery() {
CQLQuery cqlQuery = new CQLQuery();
gov.nih.nci.cagrid.cqlquery.Object target = new Object();
target.setName("gov.nih.nci.caarray.domain.array.ArrayDesign");
Association providerAssociation = new Association();
providerAssociation.setName("gov.nih.nci.caarray.domain.contact.Organization");
Attribute providerAttribute = new Attribute();
providerAttribute.setName("name");
providerAttribute.setValue(provider);
providerAttribute.setPredicate(Predicate.EQUAL_TO);
providerAssociation.setAttribute(providerAttribute);
providerAssociation.setRoleName("provider");
target.setAssociation(providerAssociation);
cqlQuery.setTarget(target);
return cqlQuery;
}
开发者ID:NCIP,项目名称:caarray,代码行数:20,代码来源:CQLSearchArrayDesign.java
示例13: attemptInstallDomainModel
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
private void attemptInstallDomainModel(DomainModel tempModel) {
// we can now add the query node to the query tree
// see if there is currently a query in the query tree
QueryTreeNode node = getQueryTree().getQueryTreeNode();
if (node != null) {
// validate the existing query against the new dommain model
CQLQuery query = node.getQuery();
try {
domainValidator.validateDomainModel(query, tempModel);
} catch (MalformedQueryException ex) {
String[] error = {
"The current query is not compatible with the selected domain model:",
ex.getMessage(), "\n",
"Please select another, or save this query and start a new one."
};
JOptionPane.showMessageDialog(this, error, "Error", JOptionPane.ERROR_MESSAGE);
return;
}
}
// domain model checked out, set it as the currently loaded one
domainModel = tempModel;
getTypeDisplayPanel().setTypeTraverser(new DomainModelTypeTraverser(domainModel));
getQueryTree().setQuery(new CQLQuery());
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:26,代码来源:QueryBuilder.java
示例14: addParameterToValues
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
private void addParameterToValues(List<ParameterValue> values) throws RepositoryException {
if (values == null) {
throw new IllegalArgumentException("Value list must not be null.") ;
}
for (ParameterValue value : values) {
if (value.getId() == null) {
throw new IllegalArgumentException("All values must have valid id set.") ;
}
CQLQuery query = newQuery().forObject(Parameter.class.getName()).with(
associationTo(ParameterValue.class.getName()).withRole("value").with(
attribute("id").equalTo(value.getId()))).build() ;
List<Parameter> params ;
try {
params = queryProcessor.processObjectQuery(query, Parameter.class) ;
} catch (QueryProcessingException e) {
throw new RepositoryException("Exception retrieving parameter value's parameter from repository.", e) ;
}
if (params.size() < 1) {
throw new IllegalArgumentException("No parameter found for parameter value with id: " + value.getId() + ".") ;
}
if (params.size() > 1) {
logger.warn("Found multiple parameters for parameter value with id: " + value.getId() + ".") ;
}
value.setParameter(params.get(0)) ;
}
}
开发者ID:NCIP,项目名称:digital-model-repository,代码行数:27,代码来源:AnzoCmefRepository.java
示例15: testCqlSearchWithCount
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
/**
* Tests searching for an entity using CQL, where the search involves associations.
*/
@Test
public void testCqlSearchWithCount() {
saveSupportingObjects();
CQLQuery cqlQuery = formulateCqlQueryWithAssociations();
QueryModifier modifier = new QueryModifier();
modifier.setCountOnly(true);
cqlQuery.setQueryModifier(modifier);
Transaction tx = null;
try {
tx = hibernateHelper.beginTransaction();
List<?> results = SEARCH_DAO.query(cqlQuery);
assertEquals(1, results.size());
assertEquals(1L, results.get(0));
tx.commit();
} catch (DAOException e) {
hibernateHelper.rollbackTransaction(tx);
fail("DAO exception during CQL search: " + e.getMessage());
}
}
开发者ID:NCIP,项目名称:caarray,代码行数:24,代码来源:SearchDaoTest.java
示例16: invokeValidQueryValidResults
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
/**
* Executes a query, which is expected to be valid and compares the
* results to gold, which is expected to be valid
* @param query
* The query to execute
* @param goldResults
* The gold results set
*/
private void invokeValidQueryValidResults(org.cagrid.cql2.CQLQuery query, CQLQueryResults goldResults) {
DataServiceClient client = getServiceClient();
CQLQueryResults queryResults = null;
boolean isSdkJdk6Error = false;
try {
queryResults = client.executeQuery(query);
// If this fails, we need to still be able to exit the jvm
} catch (Exception ex) {
if (isJava6() && isSpringJava6Error(ex)) {
// some of the datatypes don't play nice with JDK 6
isSdkJdk6Error = true;
LOG.debug("Query failed due to caCORE SDK incompatibility with JDK 6", ex);
} else {
// that's a real failure
ex.printStackTrace();
fail("Query failed to execute: " + ex.getMessage());
}
}
if (!isSdkJdk6Error) {
compareResults(goldResults, queryResults);
}
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:31,代码来源:InvokeCql2DataServiceStep.java
示例17: loadSample
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
private Sample loadSample(String sampleId) {
Sample sample = null;
try {
gov.nih.nci.cagrid.cqlquery.Object target = new gov.nih.nci.cagrid.cqlquery.Object();
target.setName("gov.nih.nci.cananolab.domain.particle.Sample");
CQLQuery query = new CQLQuery();
Attribute attribute = new Attribute();
attribute.setName("id");
attribute.setPredicate(Predicate.EQUAL_TO);
attribute.setValue(sampleId);
target.setAttribute(attribute);
query.setTarget(target);
CQLQueryResults results;
results = gridClient.query(query);
results.setTargetClassname("gov.nih.nci.cananolab.domain.particle.Sample");
CQLQueryResultsIterator iter = new CQLQueryResultsIterator(results);
while (iter.hasNext()) {
java.lang.Object obj = iter.next();
sample = (Sample) obj;
logger.info("loaded sample info for " + sampleId);
}
} catch (Exception e) {
logger.error("Error loading sample info for " + sampleId);
}
return sample;
}
开发者ID:NCIP,项目名称:cananolab,代码行数:28,代码来源:ThomsonReutersClient.java
示例18: loadAuthorsForPublication
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
private void loadAuthorsForPublication(Publication publication) {
CQLQuery query = new CQLQuery();
gov.nih.nci.cagrid.cqlquery.Object target = new gov.nih.nci.cagrid.cqlquery.Object();
target.setName("gov.nih.nci.cananolab.domain.common.Author");
Association association = new Association();
association.setName("gov.nih.nci.cananolab.domain.common.Publication");
association.setRoleName("publicationCollection");
Attribute attribute = new Attribute();
attribute.setName("id");
attribute.setPredicate(Predicate.EQUAL_TO);
attribute.setValue(publication.getId().toString());
association.setAttribute(attribute);
target.setAssociation(association);
query.setTarget(target);
try {
CQLQueryResults results = gridClient.query(query);
results.setTargetClassname("gov.nih.nci.cananolab.domain.common.Author");
CQLQueryResultsIterator iter = new CQLQueryResultsIterator(results);
Author author = null;
publication.setAuthorCollection(new HashSet<Author>());
while (iter.hasNext()) {
java.lang.Object obj = iter.next();
author = (Author) obj;
publication.getAuthorCollection().add(author);
}
} catch (Exception e) {
logger.error("Exception getting Authors for Publication id="
+ publication.getId() + ": " + e);
}
}
开发者ID:NCIP,项目名称:cananolab,代码行数:33,代码来源:ThomsonReutersClient.java
示例19: invokeInvalidQuery
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
/**
* Executes a query, which is expected to be invalid and fail
* @param query
* The expected invalid query
*/
private void invokeInvalidQuery(CQLQuery query) {
DataServiceClient client = getServiceClient();
try {
client.query(query);
fail("Query returned results, should have failed");
} catch (Exception ex) {
// expected
}
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:15,代码来源:InvokeDataServiceStep.java
示例20: fireAuditQueryBegins
import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入依赖的package包/类
/**
* Fires a query begins auditing event
*
* @param query
* @throws RemoteException
*/
protected void fireAuditQueryBegins(CQLQuery query) {
if (auditors.size() != 0) {
String callerIdentity = SecurityManager.getManager().getCaller();
QueryBeginAuditingEvent event = new QueryBeginAuditingEvent(query, callerIdentity);
for (DataServiceAuditor auditor : auditors) {
if (auditor.getAuditorConfiguration()
.getMonitoredEvents().isQueryBegin()) {
auditor.auditQueryBegin(event);
}
}
}
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:19,代码来源:BaseDataServiceImpl.java
注:本文中的gov.nih.nci.cagrid.cqlquery.CQLQuery类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论