/** * Returns true if the query verifies correctly. * * @return a boolean */ public boolean isValid() { return verifyQuery().isEmpty(); }
/** * Returns true if the query verifies correctly. * * @return a boolean */ public boolean isValid() { return verifyQuery().isEmpty(); }
/** * Returns the subclass Map for this query, if the query verifies correctly. * * @return a Map from path String to subclass name, for all PathConstraintSubclass objects * @throws PathException if the query does not verify */ public synchronized Map<String, String> getSubclasses() throws PathException { List<String> problems = verifyQuery(); if (problems.isEmpty() || Arrays.asList(NO_VIEW_ERROR).equals(problems)) { return Collections.unmodifiableMap(new LinkedHashMap<String, String>(subclasses)); } throw new PathException("Query does not verify: " + problems, null); }
/** * Returns the subclass Map for this query, if the query verifies correctly. * * @return a Map from path String to subclass name, for all PathConstraintSubclass objects * @throws PathException if the query does not verify */ public synchronized Map<String, String> getSubclasses() throws PathException { List<String> problems = verifyQuery(); if (problems.isEmpty() || Arrays.asList(NO_VIEW_ERROR).equals(problems)) { return Collections.unmodifiableMap(new LinkedHashMap<String, String>(subclasses)); } throw new PathException("Query does not verify: " + problems, null); }
/** * Returns the root path for this query, if the query verifies correctly. * * @return a String path which is the root class * @throws PathException if the query does not verify */ public synchronized String getRootClass() throws PathException { List<String> problems = verifyQuery(); // For the purposes of this method, we will permit empty views. if (problems.isEmpty() || Arrays.asList(NO_VIEW_ERROR).equals(problems)) { return rootClass; } throw new PathException("Query does not verify: " + problems, null); }
/** * Returns the root path for this query, if the query verifies correctly. * * @return a String path which is the root class * @throws PathException if the query does not verify */ public synchronized String getRootClass() throws PathException { List<String> problems = verifyQuery(); // For the purposes of this method, we will permit empty views. if (problems.isEmpty() || Arrays.asList(NO_VIEW_ERROR).equals(problems)) { return rootClass; } throw new PathException("Query does not verify: " + problems, null); }
/** * Returns the set of loop constraint descriptive strings, for the purpose of checking for * uniqueness. * * @return a Set of Strings * @throws PathException if the query does not verify */ public synchronized Set<String> getExistingLoops() throws PathException { List<String> problems = verifyQuery(); if (problems.isEmpty() || Arrays.asList(NO_VIEW_ERROR).equals(problems)) { return Collections.unmodifiableSet(new HashSet<String>(existingLoops)); } throw new PathException("Query does not verify: " + problems, null); }
/** * Returns the outer join groups map for this query, if the query verifies correctly. This is a * Map from all the class paths in the query to the outer join group, represented by the path of * the root of the group. * * @return a Map from path String to the outer join group it is in * @throws PathException if the query does not verify */ public synchronized Map<String, String> getOuterJoinGroups() throws PathException { List<String> problems = verifyQuery(); if (problems.isEmpty() || Arrays.asList(NO_VIEW_ERROR).equals(problems)) { return Collections.unmodifiableMap(new LinkedHashMap<String, String>(outerJoinGroups)); } throw new PathException("Query does not verify: " + problems, null); }
/** * Returns the set of loop constraint descriptive strings, for the purpose of checking for * uniqueness. * * @return a Set of Strings * @throws PathException if the query does not verify */ public synchronized Set<String> getExistingLoops() throws PathException { List<String> problems = verifyQuery(); if (problems.isEmpty() || Arrays.asList(NO_VIEW_ERROR).equals(problems)) { return Collections.unmodifiableSet(new HashSet<String>(existingLoops)); } throw new PathException("Query does not verify: " + problems, null); }
/** * Returns the outer join groups map for this query, if the query verifies correctly. This is a * Map from all the class paths in the query to the outer join group, represented by the path of * the root of the group. * * @return a Map from path String to the outer join group it is in * @throws PathException if the query does not verify */ public synchronized Map<String, String> getOuterJoinGroups() throws PathException { List<String> problems = verifyQuery(); if (problems.isEmpty() || Arrays.asList(NO_VIEW_ERROR).equals(problems)) { return Collections.unmodifiableMap(new LinkedHashMap<String, String>(outerJoinGroups)); } throw new PathException("Query does not verify: " + problems, null); }
public void testIncompleteConstraintLogic() { PathQuery query = createQuery("IncompleteConstraintLogic.xml"); assertEquals(Arrays.asList( "Value in constraint Employee.age > bad is not in correct format for " + "type of Integer"), query.verifyQuery()); }
public void testInvalidView() { PathQuery query = createQuery("InvalidView.xml"); assertEquals(1, query.verifyQuery().size()); }
public void testIrrelevantSortOrder() { PathQuery query = createQuery("IrrelevantSortOrder.xml"); assertEquals(Arrays.asList("Order by element for path Employee.department.name is not relevant to the query"), query.verifyQuery()); }
public void testInvalidConstraintValue() { PathQuery query = createQuery("InvalidConstraintValue.xml"); assertEquals(Collections.EMPTY_LIST, query.verifyQuery()); }
public void testInvalidConstraintLogic() { PathQuery query = createQuery("InvalidConstraintLogic.xml"); assertEquals(Collections.EMPTY_LIST, query.verifyQuery()); }
public void testEmptyView() { PathQuery query = createQuery("emptyView.xml"); assertFalse("Viewless queries should be invalid", query.isValid()); assertEquals(1, query.verifyQuery().size()); }
public void testInterMineObjectQuery() { PathQuery query = createQuery("IMObj.xml"); assertEquals(Collections.EMPTY_LIST, query.verifyQuery()); assertEquals("InterMineObject.id", query.getView().get(0)); }
public void testOldStyleJoins() throws PathException { PathQuery query = createQuery("OldStyleJoins.xml"); assertEquals(Collections.EMPTY_LIST, query.verifyQuery()); assertEquals(query.getOuterJoinStatus("Employee.department.employees"), OuterJoinStatus.OUTER); }
public void testHeaderAttributes() { PathQuery query = createQuery("HeaderAttributes.xml"); assertEquals(Collections.EMPTY_LIST, query.verifyQuery()); assertEquals(query.getTitle(), "Query Title"); assertEquals(query.getDescription(), "Query Description"); }
public void testExplicitJoins() throws PathException { PathQuery query = createQuery("ExplicitJoins.xml"); assertEquals(Collections.EMPTY_LIST, query.verifyQuery()); assertEquals(query.getOuterJoinStatus("Employee.department.company"), OuterJoinStatus.OUTER); assertEquals(query.getOuterJoinStatus("Employee.department"), OuterJoinStatus.INNER); }