本文整理汇总了Java中gov.nih.nci.cagrid.cqlquery.LogicalOperator类的典型用法代码示例。如果您正苦于以下问题:Java LogicalOperator类的具体用法?Java LogicalOperator怎么用?Java LogicalOperator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LogicalOperator类属于gov.nih.nci.cagrid.cqlquery包,在下文中一共展示了LogicalOperator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: submitMalformedQuery
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
private void submitMalformedQuery(DataServiceClient client) throws Exception {
CQLQuery query = new CQLQuery();
Object target = new Object();
target.setName(Book.class.getName());
Attribute attrib1 = new Attribute("name", Predicate.LIKE, "E%");
target.setAttribute(attrib1);
Group group = new Group();
group.setLogicRelation(LogicalOperator.AND);
group.setAttribute(new Attribute[] {
new Attribute("author", Predicate.IS_NOT_NULL, ""),
new Attribute("ISBN", Predicate.IS_NULL, "")
});
target.setGroup(group);
query.setTarget(target);
try {
client.query(query);
fail("Exception MalformedQueryExceptionType should have been thrown");
} catch (MalformedQueryExceptionType ex) {
// expected
}
}
示例2: getChangeLogicButton
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getChangeLogicButton() {
if (changeLogicButton == null) {
changeLogicButton = new JButton();
changeLogicButton.setText("Change Logic");
changeLogicButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
// get selected group to see current logic
GroupTreeNode node = (GroupTreeNode) getQueryTree().getSelectionPath().getLastPathComponent();
LogicalOperator[] ops = new LogicalOperator[] {LogicalOperator.OR, LogicalOperator.AND};
LogicalOperator choice = (LogicalOperator) JOptionPane.showInputDialog(QueryBuilder.this,
"Choose Logical Operator", "Logic", JOptionPane.QUESTION_MESSAGE,
null, ops, node.getGroup().getLogicRelation());
if (choice != null) {
node.getGroup().setLogicRelation(choice);
node.rebuild();
getQueryTree().refreshTree();
}
}
});
}
return changeLogicButton;
}
示例3: getOkButton
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
/**
* This method initializes okButton
*
* @return javax.swing.JButton
*/
private JButton getOkButton() {
if (okButton == null) {
okButton = new JButton();
okButton.setText("OK");
okButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
if (getAndLogicRadioButton().isSelected()) {
group.setLogicRelation(LogicalOperator.AND);
} else {
group.setLogicRelation(LogicalOperator.OR);
}
dispose();
}
});
}
return okButton;
}
示例4: convertLogicalOperator
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
/**
* Converts a logical operator to its HQL string equiavalent.
*
* @param op
* The logical operator to convert
* @return
* The CQL logical operator as HQL
*/
private String convertLogicalOperator(LogicalOperator op) throws QueryProcessingException {
if (op.getValue().equals(LogicalOperator._AND)) {
return "AND";
} else if (op.getValue().equals(LogicalOperator._OR)) {
return "OR";
}
throw new QueryProcessingException("Logical operator '" + op.getValue() + "' is not recognized.");
}
示例5: submitMalformedQuery
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
private void submitMalformedQuery(EnumerationDataServiceClient client) throws Exception {
CQLQuery query = new CQLQuery();
gov.nih.nci.cagrid.cqlquery.Object target = new gov.nih.nci.cagrid.cqlquery.Object();
target.setName(Book.class.getName());
Attribute attrib1 = new Attribute("name", Predicate.LIKE, "E%");
target.setAttribute(attrib1);
Group group = new Group();
group.setLogicRelation(LogicalOperator.AND);
group.setAttribute(new Attribute[] {
new Attribute("author", Predicate.IS_NOT_NULL, ""),
new Attribute("ISBN", Predicate.IS_NULL, "")
});
target.setGroup(group);
query.setTarget(target);
EnumerationResponseContainer enumContainer = null;
try {
enumContainer = client.enumerationQuery(query);
} catch (MalformedQueryExceptionType ex) {
assertTrue("Malformed Query Exception Type thrown", true);
} finally {
if (enumContainer != null && enumContainer.getContext() != null) {
Release release = new Release();
release.setEnumerationContext(enumContainer.getContext());
createDataSource(enumContainer.getEPR()).releaseOp(release);
}
}
}
示例6: convertLogicalOperator
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
/**
* Converts a logical operator to its HQL string equivalent.
*
* @param op
* The logical operator to convert
* @return
* The CQL logical operator as HQL
*/
private String convertLogicalOperator(LogicalOperator op) throws QueryTranslationException {
if (op.getValue().equals(LogicalOperator._AND)) {
return "AND";
} else if (op.getValue().equals(LogicalOperator._OR)) {
return "OR";
}
throw new QueryTranslationException("Logical operator '" + op.getValue() + "' is not recognized.");
}
示例7: convertGroup
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
private CQLGroup convertGroup(String parentClassName, Group cqlGroup) throws QueryConversionException {
CQLGroup group = new CQLGroup();
if (cqlGroup.getAssociation() != null) {
CQLAssociatedObject[] associations = new CQLAssociatedObject[cqlGroup.getAssociation().length];
for (int i = 0; i < cqlGroup.getAssociation().length; i++) {
associations[i] = convertAssociation(parentClassName, cqlGroup.getAssociation(i));
}
group.setCQLAssociatedObject(associations);
}
if (cqlGroup.getAttribute() != null) {
List<CQLAttribute> convertedAttributes = new LinkedList<CQLAttribute>();
for (Attribute attrib : cqlGroup.getAttribute()) {
CQLAttribute conversion = null;
if (unaryPredicateConversion.containsKey(attrib.getPredicate())) {
conversion = convertUnaryAttribute(attrib);
} else {
conversion = convertBinaryAttribute(parentClassName, attrib);
}
convertedAttributes.add(conversion);
}
if (convertedAttributes.size() != 0) {
CQLAttribute[] conversions = new CQLAttribute[convertedAttributes.size()];
convertedAttributes.toArray(conversions);
group.setCQLAttribute(conversions);
}
}
if (cqlGroup.getGroup() != null) {
CQLGroup[] groups = new CQLGroup[cqlGroup.getGroup().length];
for (int i = 0; i < cqlGroup.getGroup().length; i++) {
groups[i] = convertGroup(parentClassName, cqlGroup.getGroup(i));
}
group.setCQLGroup(groups);
}
GroupLogicalOperator logic =
cqlGroup.getLogicRelation() == LogicalOperator.AND
? GroupLogicalOperator.AND : GroupLogicalOperator.OR;
group.setLogicalOperation(logic);
return group;
}
示例8: convertGroup
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
private static Group convertGroup(CQLGroup cql2Group) throws QueryConversionException {
if (cql2Group.getCQLExtension() != null) {
throw new QueryConversionException("CQL 1 does not support query extensions");
}
Group group = new Group();
group.setLogicRelation(cql2Group.getLogicalOperation() == GroupLogicalOperator.AND
? LogicalOperator.AND : LogicalOperator.OR);
if (cql2Group.getCQLAssociatedObject() != null) {
Association[] associations = new Association[cql2Group.getCQLAssociatedObject().length];
for (int i = 0; i < cql2Group.getCQLAssociatedObject().length; i++) {
associations[i] = convertAssociation(cql2Group.getCQLAssociatedObject(i));
}
group.setAssociation(associations);
}
if (cql2Group.getCQLAttribute() != null) {
Attribute[] attributes = new Attribute[cql2Group.getCQLAttribute().length];
for (int i = 0; i < cql2Group.getCQLAttribute().length; i++) {
attributes[i] = convertAttribute(cql2Group.getCQLAttribute(i));
}
group.setAttribute(attributes);
}
if (cql2Group.getCQLGroup() != null) {
Group[] groups = new Group[cql2Group.getCQLGroup().length];
for (int i = 0; i < cql2Group.getCQLGroup().length; i++) {
groups[i] = convertGroup(cql2Group.getCQLGroup(i));
}
group.setGroup(groups);
}
return group;
}
示例9: initLogicButtons
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
private void initLogicButtons() {
// walk the static logical op fields
Field[] fields = LogicalOperator.class.getFields();
List<String> ops = new ArrayList<String>();
for (int i = 0; i < fields.length; i++) {
int mods = fields[i].getModifiers();
if (Modifier.isStatic(mods) && Modifier.isPublic(mods)
&& fields[i].getType().equals(LogicalOperator.class)) {
try {
LogicalOperator l = (LogicalOperator) fields[i].get(null);
ops.add(l.getValue());
} catch (IllegalAccessException ex) {
ex.printStackTrace();
}
}
}
// sort the predicates by value
Collections.sort(ops);
// create buttons
for (int i = 0; i < ops.size(); i++) {
JRadioButton button = new JRadioButton(ops.get(i));
group.add(button);
if (button.getText().equals(LogicalOperator._AND)) {
// schema default for logical ops is AND
group.setSelected(button.getModel(), true);
}
GridBagConstraints cons = new GridBagConstraints();
cons.insets = new Insets(2, 2, 2, 2);
cons.gridx = 0;
cons.gridy = i;
cons.anchor = GridBagConstraints.WEST;
cons.fill = GridBagConstraints.HORIZONTAL;
cons.weightx = 1.0D;
add(button, cons);
}
}
示例10: getLogicalOperator
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
public LogicalOperator getLogicalOperator() {
String textValue = null;
Enumeration buttons = group.getElements();
while (buttons.hasMoreElements()) {
JRadioButton button = (JRadioButton) buttons.nextElement();
if (button.getModel().equals(group.getSelection())) {
textValue = button.getText();
break;
}
}
return LogicalOperator.fromString(textValue);
}
示例11: initialize
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
private void initialize() {
this.setContentPane(getMainPanel());
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(getAndLogicRadioButton());
buttonGroup.add(getOrLogicRadioButton());
if (group.getLogicRelation().equals(LogicalOperator.AND)) {
buttonGroup.setSelected(getAndLogicRadioButton().getModel(), true);
} else {
buttonGroup.setSelected(getOrLogicRadioButton().getModel(), true);
}
}
示例12: convertLogicalOperator
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
/**
* Converts a logical operator to its HQL string equivalent.
*
* @param op
* The logical operator to convert
* @return
* The CQL logical operator as HQL
*/
private String convertLogicalOperator(LogicalOperator op) throws QueryProcessingException {
if (op.getValue().equals(LogicalOperator._AND)) {
return "AND";
} else if (op.getValue().equals(LogicalOperator._OR)) {
return "OR";
}
throw new QueryProcessingException("Logical operator '" + op.getValue() + "' is not recognized.");
}
示例13: convertToDcql2Group
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
private DCQLGroup convertToDcql2Group(String targetServiceUrl, String className, Group oldGroup)
throws DCQLConversionException {
DCQLGroup group = new DCQLGroup();
group.setLogicalOperation(LogicalOperator.AND.equals(
oldGroup.getLogicRelation()) ?
GroupLogicalOperator.AND : GroupLogicalOperator.OR);
if (oldGroup.getAssociation() != null && oldGroup.getAssociation().length != 0) {
DCQLAssociatedObject[] associations = new DCQLAssociatedObject[oldGroup.getAssociation().length];
for (int i = 0; i < oldGroup.getAssociation().length; i++) {
associations[i] = convertToDcql2Association(targetServiceUrl, oldGroup.getAssociation(i));
}
group.setAssociatedObject(associations);
}
if (oldGroup.getAttribute() != null && oldGroup.getAttribute().length != 0) {
CQLAttribute[] attributes = new CQLAttribute[oldGroup.getAttribute().length];
for (int i = 0; i < oldGroup.getAttribute().length; i++) {
attributes[i] = convertToCql2Attribute(targetServiceUrl, className, oldGroup.getAttribute(i));
}
group.setAttribute(attributes);
}
if (oldGroup.getGroup() != null && oldGroup.getGroup().length != 0) {
DCQLGroup groups[] = new DCQLGroup[oldGroup.getGroup().length];
for (int i = 0; i < oldGroup.getGroup().length; i++) {
groups[i] = convertToDcql2Group(targetServiceUrl, className, oldGroup.getGroup(i));
}
group.setGroup(groups);
}
if (oldGroup.getForeignAssociation() != null && oldGroup.getForeignAssociation().length != 0) {
ForeignAssociatedObject[] foreignAssociations = new ForeignAssociatedObject[oldGroup.getForeignAssociation().length];
for (int i = 0; i < oldGroup.getForeignAssociation().length; i++) {
foreignAssociations[i] = convertToDcql2ForeignAssociation(oldGroup.getForeignAssociation(i));
}
group.setForeignAssociatedObject(foreignAssociations);
}
return group;
}
示例14: createCqlQuery
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
private CQLQuery createCqlQuery(String arrayDesignName) {
CQLQuery cqlQuery = new CQLQuery();
Object target = new Object();
target.setName("gov.nih.nci.caarray.domain.project.Experiment");
Association arrayDesignAssociation = new Association();
arrayDesignAssociation.setName("gov.nih.nci.caarray.domain.array.ArrayDesign");
Attribute nameAttribute = new Attribute();
nameAttribute.setName("name");
nameAttribute.setValue(arrayDesignName);
nameAttribute.setPredicate(Predicate.EQUAL_TO);
arrayDesignAssociation.setAttribute(nameAttribute);
arrayDesignAssociation.setRoleName("arrayDesigns");
Association experimentDesignAssociation = new Association();
experimentDesignAssociation.setName("gov.nih.nci.caarray.domain.vocabulary.Term");
Attribute valueAttribute = new Attribute();
valueAttribute.setName("value");
valueAttribute.setValue(EXPERIMENTAL_DESIGN);
valueAttribute.setPredicate(Predicate.EQUAL_TO);
experimentDesignAssociation.setAttribute(valueAttribute);
experimentDesignAssociation.setRoleName("experimentDesignTypes");
Group associations = new Group();
associations.setAssociation(new Association[] { arrayDesignAssociation, experimentDesignAssociation });
associations.setLogicRelation(LogicalOperator.AND);
target.setGroup(associations);
cqlQuery.setTarget(target);
return cqlQuery;
}
示例15: createCqlQuery
import gov.nih.nci.cagrid.cqlquery.LogicalOperator; //导入依赖的package包/类
private CQLQuery createCqlQuery(String manufacturerName, String organismName) {
CQLQuery cqlQuery = new CQLQuery();
Object target = new Object();
target.setName("gov.nih.nci.caarray.domain.project.Experiment");
Association manufacturerAssociation = new Association();
manufacturerAssociation.setName("gov.nih.nci.caarray.domain.contact.Organization");
Attribute manufacturerAttribute = new Attribute();
manufacturerAttribute.setName("name");
manufacturerAttribute.setValue(manufacturerName);
manufacturerAttribute.setPredicate(Predicate.EQUAL_TO);
manufacturerAssociation.setAttribute(manufacturerAttribute);
manufacturerAssociation.setRoleName("manufacturer");
Association organismAssociation = new Association();
organismAssociation.setName("edu.georgetown.pir.Organism");
Attribute organismAttribute = new Attribute();
organismAttribute.setName("commonName");
organismAttribute.setValue(organismName);
organismAttribute.setPredicate(Predicate.EQUAL_TO);
organismAssociation.setAttribute(organismAttribute);
organismAssociation.setRoleName("organism");
Group associations = new Group();
associations.setAssociation(new Association[] { manufacturerAssociation, organismAssociation });
associations.setLogicRelation(LogicalOperator.AND);
target.setGroup(associations);
cqlQuery.setTarget(target);
return cqlQuery;
}