Version 1 (modified by trac, 3 years ago)

--

Trac Ticket Queries

In addition to reports, Trac provides support for custom ticket queries, used to display lists of tickets meeting a specified set of criteria.

To configure and execute a custom query, switch to the View Tickets module from the navigation bar, and select the Custom Query link.

Filters

When you first go to the query page the default filters will display all open tickets, or if you're logged in it will display open tickets assigned to you. Current filters can be removed by clicking the button to the right with the minus sign on the label. New filters are added from the pulldown list in the bottom-right corner of the filters box. Filters with either a text box or a pulldown menu of options can be added multiple times to perform an or of the criteria.

You can use the fields just below the filters box to group the results based on a field, or display the full description for each ticket.

Once you've edited your filters click the Update button to refresh your results.

Clicking on one of the query results will take you to that ticket. You can navigate through the results by clicking the Next Ticket or Previous Ticket links just below the main menu bar, or click the Back to Query link to return to the query page.

You can safely edit any of the tickets and continue to navigate through the results using the Next/Previous/Back? to Query links after saving your results. When you return to the query any tickets which were edited will be displayed with italicized text. If one of the tickets was edited such that it no longer matches the query criteria the text will also be greyed. Lastly, if a new ticket matching the query criteria has been created, it will be shown in bold.

The query results can be refreshed and cleared of these status indicators by clicking the Update button again.

Saving Queries

While Trac does not yet allow saving a named query and somehow making it available in a navigable list, you can save references to queries in Wiki content, as described below.

You may want to save some queries so that you can come back to them later. You can do this by making a link to the query from any Wiki page.

[query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]

Which is displayed as:

Active tickets against 1.0

This uses a very simple query language to specify the criteria (see Query Language).

Alternatively, you can copy the query string of a query and paste that into the Wiki link, including the leading ? character:

[query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]

Which is displayed as:

Assigned tickets by owner

Using the [[TicketQuery]] Macro

The  TicketQuery macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting.

Example:

[[TicketQuery(version=0.6|0.7&resolution=duplicate)]]

This is displayed as:

No results

Just like the query: wiki links, the parameter of this macro expects a query string formatted according to the rules of the simple ticket query language.

A more compact representation without the ticket summaries is also available:

[[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]

This is displayed as:

No results

Finally if you wish to receive only the number of defects that match the query using the count parameter.

[[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]

This is displayed as:

0

Customizing the table format

You can also customize the columns displayed in the table format (format=table) by using col=<field> - you can specify multiple fields and what order they are displayed by placing pipes (|) between the columns like below:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]

This is displayed as:

Results (1 - 3 of 63)

Ticket Resolution Summary Owner Reporter
#67 fixed Adding of platforms (still) does not work work@…
#66 fixed getMeasurementData REST interface does not implement 'verbose' argument m.s.vanvliet@… work@…
#65 fixed REST interface returns incorrect data m.s.vanvliet@… work@…

Full rows

In table format you can also have full rows by using rows=<field> like below:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]]

This is displayed as:

Results (1 - 3 of 63)

Ticket Resolution Summary Owner Reporter
#67 fixed Adding of platforms (still) does not work work@…

Reported by work@…, 2 years ago.

description

try to add a platform and you'll get an exception in the console / log (reproducible on ci):

2012-04-02 13:31:48,944 [http-8081-6] ERROR errors.GrailsExceptionResolver  - Exception occurred when processing request: [POST] /metabolomicsModule-0.2.1-ci/measurementPlatform/add
Stacktrace follows:
groovy.lang.MissingMethodException: No signature of method: org.grails.datastore.gorm.validation.constraints.UniqueConstraint$_withManualFlushMode_closure2.doCall() is applicable for argument types: ($Proxy36) values: [SessionImpl(PersistenceContext[entityKeys=[EntityKey[org.dbxp.moduleBase.Auth#168], EntityKey[org.dbxp.moduleBase.Auth#168871], EntityKey[org.dbxp.moduleBase.Auth#136], EntityKey[org.dbxp.moduleBase.Auth#1439], EntityKey[org.dbxp.moduleBase.Auth#168840], EntityKey[org.dbxp.moduleBase.User#120], EntityKey[org.dbxp.moduleBase.Auth#1498], EntityKey[org.dbxp.moduleBase.Auth#1438], EntityKey[org.dbxp.moduleBase.Auth#1497], EntityKey[org.dbxp.moduleBase.Auth#1496], EntityKey[org.dbxp.moduleBase.Auth#1440], EntityKey[org.dbxp.moduleBase.Auth#85655], EntityKey[org.dbxp.moduleBase.Auth#1442], EntityKey[org.dbxp.moduleBase.Auth#124], EntityKey[org.dbxp.moduleBase.Auth#85658], EntityKey[org.dbxp.moduleBase.Auth#85657]],collectionKeys=[CollectionKey[org.dbxp.moduleBase.User.auth#120]]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])]
Possible solutions: doCall(org.grails.datastore.mapping.core.Session), call(), call([Ljava.lang.Object;), call(java.lang.Object), call(org.grails.datastore.mapping.core.Session), equals(java.lang.Object)
	at $Proxy35.doInHibernate(Unknown Source)
	at org.grails.datastore.gorm.validation.constraints.UniqueConstraint.withManualFlushMode(UniqueConstraint.groovy:103)
	at org.grails.datastore.gorm.validation.constraints.UniqueConstraint$withManualFlushMode.callCurrent(Unknown Source)
	at org.grails.datastore.gorm.validation.constraints.UniqueConstraint.processValidate(UniqueConstraint.groovy:39)
	at org.dbxp.metabolomicsModule.measurements.MeasurementPlatformController$_closure4.doCall(MeasurementPlatformController.groovy:45)
	at org.dbxp.metabolomicsModule.measurements.MeasurementPlatformController$_closure4.doCall(MeasurementPlatformController.groovy)
	at java.lang.Thread.run(Thread.java:662)
#66 fixed getMeasurementData REST interface does not implement 'verbose' argument m.s.vanvliet@… work@…

Reported by work@…, 2 years ago.

description

In contrast to the SAM and Metagenomics modules, the metabolomics module does not correctly implement the _verbose_ argument.

Regardless if the _verbose_ argument is set to true or to false, the result is always:

[
[
"76ffc208-229f-4c57-8f05-3957a5b71276",
"d119fe48-94a1-414b-acb7-10ff99e2c0ee",
"ced19e94-f0b8-43e1-bada-27b217fa12fa",
"495b22b7-7c76-4c3b-8a91-48095ee76d5c",
"3e7f1bb3-1605-4a28-b39b-1ba3feb6f06b",
"12315c72-541d-40b2-ae0a-7b25927113d3",
"47ed2d81-8b33-4d76-b5f8-9db5ffeb790f",
"ff8429f1-c49c-47d8-bfa6-f4af3a6d0587",
"180df6e2-758f-462e-b87f-1dc17227a9f8",
"53eb0b24-6349-4439-9934-badbb5990c65",
"310e9b32-2280-4e7d-8b56-74f9a34802e8",
"bcbaef0f-fede-4f4e-923b-aa350cd4872b",
"c7f1d773-d80c-4b59-a46e-b381c24205eb",
"7a5a8bbb-bd13-4245-acdf-1a16287ca6a1",
"b0ea46f9-d2e3-4d22-9841-13d5c615f3a5",
"9458c9a9-2999-4412-a190-43f5f5a6cbcd",
"6eced435-f292-4610-abad-fcea41519b63",
"b6b8948a-bd66-4acf-95bb-e99548264dc1",
"dad82e3f-06e9-42ee-8a22-864971bdf11b",
"5d347e25-bd22-4772-8320-0561d76770dd"
],
[
"PA(12:0/13:0)",
"PA(16:0/18:1(9Z))"
],
[
123,
789,
111,
314,
214,
414,
324,
311,
214,
315,
316,
456,
101,
121,
151,
251,
331,
155,
451,
251,
131,
251
]
]

According to the API spec at  http://dbnp.org/dbnp/modules-1/detailed-descriptions-of-restful-services the _verbose=false_ argument should return an array with 3 sub-arrays containing (1) a list of sampleTokens, (2) a list of measurementTokens, (3) a list of values

While the _verbose=true_ should return one array containing all samples and their measurements. See below for examples taken from SAM.

Example SAM reply with verbose=true:

[
{
"measurementToken":
"Fat Depot",
"sampleToken":
"a4d16db8-49f2-4dc2-81bb-910e574c804a",
"value":
311
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"6bfe2a0d-3af0-4ed8-8144-56840e934f6e",
"value":
456
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"c180d727-8d6c-4673-a5fd-1c28f04b8aaa",
"value":
347
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"4edff5ad-c3af-41da-8efe-87f5a018912a",
"value":
368
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"07378e29-3233-4e3f-b4ea-007f9f9b1317",
"value":
310
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"4861fc77-1320-4401-b18a-66b1cd67d2c8",
"value":
411
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"f7392df1-a754-4957-a1d0-c98bbb91080d",
"value":
318
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"a556b145-dd37-4568-92f1-e3a251653276",
"value":
1150
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"2c719340-eb7f-4a70-8527-c64cc74dc542",
"value":
1039
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"775666dd-05b1-4f35-ac9c-d36f8257eb1a",
"value":
2075
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"fc755220-b2b4-43ed-adf8-e4323fc62b55",
"value":
1308
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"198183b1-d402-4f24-9c5a-396f79bb6a55",
"value":
1918
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"e888b1b1-1dc8-45ed-8196-00338fa3b36f",
"value":
1387
},
{
"measurementToken":
"Fat Depot",
"sampleToken":
"7e9930bc-ec8c-4e74-bd2b-49d6c852eeda",
"value":
945
}
]

Example SAM reply with verbose=false:

[
[
"a4d16db8-49f2-4dc2-81bb-910e574c804a",
"6bfe2a0d-3af0-4ed8-8144-56840e934f6e",
"c180d727-8d6c-4673-a5fd-1c28f04b8aaa",
"4edff5ad-c3af-41da-8efe-87f5a018912a",
"07378e29-3233-4e3f-b4ea-007f9f9b1317",
"4861fc77-1320-4401-b18a-66b1cd67d2c8",
"f7392df1-a754-4957-a1d0-c98bbb91080d",
"a556b145-dd37-4568-92f1-e3a251653276",
"2c719340-eb7f-4a70-8527-c64cc74dc542",
"775666dd-05b1-4f35-ac9c-d36f8257eb1a",
"fc755220-b2b4-43ed-adf8-e4323fc62b55",
"198183b1-d402-4f24-9c5a-396f79bb6a55",
"e888b1b1-1dc8-45ed-8196-00338fa3b36f",
"7e9930bc-ec8c-4e74-bd2b-49d6c852eeda"
],
[
"Fat Depot"
],
[
311,
456,
347,
368,
310,
411,
318,
1150,
1039,
2075,
1308,
1918,
1387,
945
]
]

So, the metabolomics module seems to always return data in the _verbose=false_ format.

Michael, is this something you can fix?

#65 fixed REST interface returns incorrect data m.s.vanvliet@… work@…

Reported by work@…, 2 years ago.

description

Study: DiogonesMock?

The study contains one assay:

"assays":
[
{
"module":
"Metabolomics module",
"name":
"LCMS",
"token":
"6f2558db-a20c-4e6a-8d86-49391ca1aed1"
}

And this assay contains 10 samples. When you browse to the metabolomics module, you see that the uploaded file for this study contains 11 samples, however none were matched.

When you call the metabolomics REST interface (see below) you would expect that you receive all measurement information for _matched_ samples. And as there are no matched samples you would expect the REST interface to result nothing.

However, the REST interface returns 22 results (the uploaded file contained 11 samples), even though they were not matched agains samples.

Expected behavior: return only data about matched samples Actual behavior: return all samples that were in uploaded files attached to the assay

Result set for the three calls: * getMeasurements * getMeasurementData (verbose) * getMeasurementMetaData

{
"data":
[
[
"76ffc208-229f-4c57-8f05-3957a5b71276",
"d119fe48-94a1-414b-acb7-10ff99e2c0ee",
"ced19e94-f0b8-43e1-bada-27b217fa12fa",
"495b22b7-7c76-4c3b-8a91-48095ee76d5c",
"3e7f1bb3-1605-4a28-b39b-1ba3feb6f06b",
"12315c72-541d-40b2-ae0a-7b25927113d3",
"47ed2d81-8b33-4d76-b5f8-9db5ffeb790f",
"ff8429f1-c49c-47d8-bfa6-f4af3a6d0587",
"180df6e2-758f-462e-b87f-1dc17227a9f8",
"53eb0b24-6349-4439-9934-badbb5990c65",
"310e9b32-2280-4e7d-8b56-74f9a34802e8",
"bcbaef0f-fede-4f4e-923b-aa350cd4872b",
"c7f1d773-d80c-4b59-a46e-b381c24205eb",
"7a5a8bbb-bd13-4245-acdf-1a16287ca6a1",
"b0ea46f9-d2e3-4d22-9841-13d5c615f3a5",
"9458c9a9-2999-4412-a190-43f5f5a6cbcd",
"6eced435-f292-4610-abad-fcea41519b63",
"b6b8948a-bd66-4acf-95bb-e99548264dc1",
"dad82e3f-06e9-42ee-8a22-864971bdf11b",
"5d347e25-bd22-4772-8320-0561d76770dd"
],
[
"PA(12:0/13:0)",
"PA(16:0/18:1(9Z))"
],
[
123,
789,
111,
314,
214,
414,
324,
311,
214,
315,
316,
456,
101,
121,
151,
251,
331,
155,
451,
251,
131,
251
]
],
"measurements":
[
"PA(12:0/13:0)",
"PA(16:0/18:1(9Z))"
],
"metaData":
[
{
"InChI":
"InChI=1S/C6H12O6/c7-1-2-3(8)4(9)5(10)6(11)12-2/h2-11H,1H2/t2-,3-,4+,5-,6?/m1/s1",
"PubChem":
5793,
"comment":
"DCL_CID_0000001",
"compound":
"Glucose",
"formula":
"C6H12O6",
"m/z":
345.452,
"name":
"PA(12:0/13:0)"
},
{
"InChI":
"InChI=1S/C7H6N2/c1-2-4-7-6(3-1)8-5-9-7/h1-5H,(H,8,9)",
"PubChem":
5798,
"comment":
"DCL_CID_0000002",
"compound":
"Benzimidazole",
"formula":
"C7H6N2",
"m/z":
235.221,
"name":
"PA(16:0/18:1(9Z))"
},
{
"InChI":
"InChI=1S/C23H30O6/c1-13(24)29-12-19(27)23(28)9-7-17-16-5-4-14-10-15(25)6-8-21(14,2)20(16)18(26)11-22(17,23)3/h6,8,10,16-18,20,26,28H,4-5,7,9,11-12H2,1-3H3/t16-,17-,18-,20+,21-,22-,23-/m0/s1",
"PubChem":
5834,
"comment":
"DCL_CID_0000003",
"compound":
"Prednisolone acetate",
"formula":
"C23H30O6",
"m/z":
346.733,
"name":
"PA(17:0/14:1(9Z))"
},
{
"InChI":
"InChI=1S/C20H28O/c1-3-20(21)13-11-18-17-9-8-14-6-4-5-7-15(14)16(17)10-12-19(18,20)2/h1,6,15-18,21H,4-5,7-13H2,2H3/t15-,16+,17+,18-,19-,20-/m0/s1",
"PubChem":
5857,
"comment":
"DCL_CID_0000004",
"compound":
"Lynestrenol",
"formula":
"C20H28O",
"m/z":
542.352,
"name":
"PA(6:0/6:0)"
},
{
"InChI":
"InChI=1S/C10H16NO5PS2/c1-11(2)19(12,13)10-7-5-9(6-8-10)16-17(18,14-3)15-4/h5-8H,1-4H3",
"PubChem":
5859,
"comment":
"DCL_CID_0000005",
"compound":
"Famophos",
"formula":
"C10H16NO5PS2",
"m/z":
234.324,
"name":
"PA(8:0/8:0)"
},
{
"InChI":
"InChI=1S/C24H32O6/c1-13-9-16-17-6-8-24(29,20(28)12-30-14(2)25)23(17,4)11-19(27)21(16)22(3)7-5-15(26)10-18(13)22/h5,7,10,13,16-17,19,21,27,29H,6,8-9,11-12H2,1-4H3/t13-,16-,17-,19-,21+,22-,23-,24-/m0/s1",
"PubChem":
5877,
"comment":
"DCL_CID_0000006",
"compound":
"Methylprednisolone acetate",
"formula":
"C24H32O6",
"m/z":
562.326,
"name":
"PA(10:0/10:0)"
},
{
"InChI":
"InChI=1S/C49H70N14O11/c1-26(2)39(61-42(67)33(12-8-18-55-49(52)53)57-41(66)32(50)23-38(51)65)45(70)58-34(20-29-14-16-31(64)17-15-29)43(68)62-40(27(3)4)46(71)59-35(22-30-24-54-25-56-30)47(72)63-19-9-13-37(63)44(69)60-36(48(73)74)21-28-10-6-5-7-11-28/h5-7,10-11,14-17,24-27,32-37,39-40,64H,8-9,12-13,18-23,50H2,1-4H3,(H2,51,65)(H,54,56)(H,57,66)(H,58,70)(H,59,71)(H,60,69)(H,61,67)(H,62,68)(H,73,74)(H4,52,53,55)",
"PubChem":
5890,
"comment":
"DCL_CID_0000007",
"compound":
"Angiotensin Amide",
"formula":
"C49H70N14O11",
"m/z":
164.235,
"name":
"PA(18:0/18:0)"
},
{
"InChI":
"InChI=1S/C9H9NO3/c1-10-4-9(13)5-2-7(11)8(12)3-6(5)10/h2-3,9,13H,4H2,1H3",
"PubChem":
5898,
"comment":
"DCL_CID_0000008",
"compound":
"Adrenochrome",
"formula":
"C9H9NO3",
"m/z":
362.362,
"name":
"PA(12:0/12:0)"
},
{
"InChI":
"InChI=1S/C16H18ClN.ClH/c17-11-12-18(13-15-7-3-1-4-8-15)14-16-9-5-2-6-10-16;/h1-10H,11-14H2;1H",
"PubChem":
5925,
"comment":
"DCL_CID_0000009",
"compound":
"Dibenamine hydrochloride",
"formula":
"C16H19Cl2N",
"m/z":
245.235,
"name":
"PA(12:0/15:0)"
},
{
"InChI":
"InChI=1S/C12H30N2.2BrH/c1-13(2,3)11-9-7-8-10-12-14(4,5)6;;/h7-12H2,1-6H3;2*1H/q+2;;/p-2",
"PubChem":
5938,
"comment":
"DCL_CID_0000010",
"compound":
"Hexamethonium",
"formula":
"C12H30Br2N2",
"m/z":
331.342,
"name":
"PA(12:0/18:2(9Z,12Z))"
}
]
}

Query Language

query: TracLinks and the [[TicketQuery]] macro both use a mini “query language” for specifying query filters. Basically, the filters are separated by ampersands (&). Each filter then consists of the ticket field name, an operator, and one or more values. More than one value are separated by a pipe (|), meaning that the filter matches any of the values.

The available operators are:

= the field content exactly matches the one of the values
~= the field content contains one or more of the values
^= the field content starts with one of the values
$= the field content ends with one of the values

All of these operators can also be negated:

!= the field content matches none of the values
!~= the field content does not contain any of the values
!^= the field content does not start with any of the values
!$= the field content does not end with any of the values

See also: TracTickets, TracReports, TracGuide