If you are one of the hearty few who've given Browse-by-Query a try, or if you've just glanced at the web site--and you have anything to say to the developer (that's me), this is the place (or you can e-mail me...)
If you see problems with the code or documentation, can think of a useful new feature, hate the syntax and want to suggest a new one, or just want to tell me that the whole thing is a waster of time :), feel free to start a topic here.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By reviewing the website, the plugin looks interesting and seems like a great new idea. Its clear you went to a lot of effort in creating the manual. However, I couldn't find much for example usage. It would help illustrate the value and overcome the learning curve tremendously, if you could provide a large variety of example usages.
Regards,
Bill
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've had trouble coming up with examples that were both interesting and not tied to the idiosyncracies of my development process-- I see this is an important lack.
I'll be working on a revised manual with many more examples.
--Michael MacDonald
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i want to search method which has prepared statement\ resultset but no close method has been called . Close can be called in the caller method also . for example .
method1()
{
resultset= method2 ()
resultset.close()
}
public Resultset method2 ()
{
return resultset
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This requirement results in a pretty complex query--
not exists (
matching "ResultSet" classes containing matching "close" methods called by
calls rom recursive ( methods containing, calls to ) ) calls to methods with type "java.sql.ResultSet"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
not exists
( matching "ResultSet" classes containing matching "close" methods called by calls from recursive ( methods containing, calls to ) ) calls to methods with type "java.sql.ResultSet"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for the double posts; I'm unfamiliar with this forum software.
I'd like to include a correctly spelled, formatted version of the query, and a brief explanation.
not exists (
matching "ResultSet" classes containing matching "close" methods called by
calls from
recursive ( methods containing, calls to )
) calls to methods with type "java.sql.ResultSet"
There are a couple of ways of performing a similar query; I decided to show one that doesn't use the set operators.
This query starts with the set of calls to methods that return a result set. Starting with this set, it looks up the call tree of those methods--recursive ( methods containing, calls to )-- looking for a call to "close" in ResultSet. If such a call is not found, the call returning a ResultSet is displayed.
You can go into special cases here-- for example, you might not want to recurse all the way up the call tree, but depending on the structure of your app, this may be what you want.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This looks like a great tool, but it would help to have examples for each of the elements. Without that, I'm afraid I'm a bit lost. At the momement, I just want to find all subtypes of Foo that make calls to another class, Bar. How would you do that? The first part is easy enough:
recursive derived classes of class "Foo"
and that seems to work. How do I add the rest?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm sorry there aren't more examples in the manual. I should definitely address that.
In the meantime I can answer your specific question here, and it might serve as the basis for a useful example.
(Note that for Foo and Bar, I've substituted IEditorPart and IAdaptable from Eclipse, so these will run from the demo page)
There are two ways to approach such a query in BBQ. BBQ encourages thinking about sets, and the cleaner way to accomplish the query is to think about in terms of the intersection of two sets, the sets of calls from methods in the child classes of Foo, and the set of calls to methods in class Bar. Specificially:
(
calls from methods in
recursive derived classes of class "org.eclipse.ui.IEditorPart"
)
intersection
(
calls to methods in class "org.eclipse.core.runtime.IAdaptable"
)
Another way to think of it, which is more straightforward to some, is that you are looking at calls from methods in the child classes of Foo, and you want only those calls that meet a certain condition: the condition that the calls are to methods in class Bar. You can use the 'exists' filter to impose conditions like this:
exists ( matching "IAdaptable" classes containing methods called by ) calls from methods in
recursive derived classes of class "org.eclipse.ui.IEditorPart"
The two approaches are equivalent and the queries will return the same set of calls.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I like a lot the idea; but I´ve found myself not getting the point at the syntax. Would be great if the manual has some appendix with bnf grammar for the language, for reference.
Browse by query seems a great idea to me, and it seems we will hear more about it in the future.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a great tool. However it would be really useful for me to be able to pass queries on the command line and have the output to stdout rather than from within the gui. This is because I would really like to use it for report generation. Is there anyway to do this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Where <file> can be a .class file, a .jar (all contained class files and
jars will be added to the database), or a directory (which is traversed and
all contained class files or jars are added to the database).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there any way to clear the BBQ database or more importantly remove a project from the database? For instance, I am doing queries on project1 and I now move on to project2, but I do not want my results tainted by possible replicant class/method names in the original project.
Thanks in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is no way to clear specific content from a BBQ database. Best thing to do in your circumstance is to clear the db and rebuild it do what you want. There is a menu command in the UI to clear the db (standalone) or to rebuild the db (eclipse).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Have you considered a graphical display for the sets selected? One interesting possibility would be to have graphs where
+ Nodes are: packages/classes/methods/call points, selected as sets to be presented
+ The layout handles nesting of packages/classes/methods/call points (possibly presenting the container implicitly)
+ Edges are specified as a transform applied to a subset of nodes, with the other end of the transform being added if not present.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to search for all fields of a certain type. I can use the matching keyword for this but the type I am searching for is a substring of other classes. For example, I am searching for fields matching "Core" and my results might include fields matching "CoreComponent". I know that regular expressions can be used as well, but I can't find a way to specify that I don't want to search for a substring. Is there anything else in BBQ that will allow me to do this? Or does anyone know how to do it in regular expressions?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you are one of the hearty few who've given Browse-by-Query a try, or if you've just glanced at the web site--and you have anything to say to the developer (that's me), this is the place (or you can e-mail me...)
If you see problems with the code or documentation, can think of a useful new feature, hate the syntax and want to suggest a new one, or just want to tell me that the whole thing is a waster of time :), feel free to start a topic here.
Hi Michael,
By reviewing the website, the plugin looks interesting and seems like a great new idea. Its clear you went to a lot of effort in creating the manual. However, I couldn't find much for example usage. It would help illustrate the value and overcome the learning curve tremendously, if you could provide a large variety of example usages.
Regards,
Bill
You're right.
I've had trouble coming up with examples that were both interesting and not tied to the idiosyncracies of my development process-- I see this is an important lack.
I'll be working on a revised manual with many more examples.
--Michael MacDonald
A revised manual with a tutorial chapter has been posted along with the latest release (0.5.4)
i want to search method which has prepared statement\ resultset but no close method has been called . Close can be called in the caller method also . for example .
method1()
{
resultset= method2 ()
resultset.close()
}
public Resultset method2 ()
{
return resultset
}
This requirement results in a pretty complex query--
not exists (
matching "ResultSet" classes containing matching "close" methods called by
calls rom recursive ( methods containing, calls to ) ) calls to methods with type "java.sql.ResultSet"
After a few minutes thought, I came up with this:
not exists
( matching "ResultSet" classes containing matching "close" methods called by calls from recursive ( methods containing, calls to ) ) calls to methods with type "java.sql.ResultSet"
Sorry for the double posts; I'm unfamiliar with this forum software.
I'd like to include a correctly spelled, formatted version of the query, and a brief explanation.
not exists (
matching "ResultSet" classes containing matching "close" methods called by
calls from
recursive ( methods containing, calls to )
) calls to methods with type "java.sql.ResultSet"
There are a couple of ways of performing a similar query; I decided to show one that doesn't use the set operators.
This query starts with the set of calls to methods that return a result set. Starting with this set, it looks up the call tree of those methods--recursive ( methods containing, calls to )-- looking for a call to "close" in ResultSet. If such a call is not found, the call returning a ResultSet is displayed.
You can go into special cases here-- for example, you might not want to recurse all the way up the call tree, but depending on the structure of your app, this may be what you want.
This looks like a great tool, but it would help to have examples for each of the elements. Without that, I'm afraid I'm a bit lost. At the momement, I just want to find all subtypes of Foo that make calls to another class, Bar. How would you do that? The first part is easy enough:
recursive derived classes of class "Foo"
and that seems to work. How do I add the rest?
I'm sorry there aren't more examples in the manual. I should definitely address that.
In the meantime I can answer your specific question here, and it might serve as the basis for a useful example.
(Note that for Foo and Bar, I've substituted IEditorPart and IAdaptable from Eclipse, so these will run from the demo page)
There are two ways to approach such a query in BBQ. BBQ encourages thinking about sets, and the cleaner way to accomplish the query is to think about in terms of the intersection of two sets, the sets of calls from methods in the child classes of Foo, and the set of calls to methods in class Bar. Specificially:
(
calls from methods in
recursive derived classes of class "org.eclipse.ui.IEditorPart"
)
intersection
(
calls to methods in class "org.eclipse.core.runtime.IAdaptable"
)
Another way to think of it, which is more straightforward to some, is that you are looking at calls from methods in the child classes of Foo, and you want only those calls that meet a certain condition: the condition that the calls are to methods in class Bar. You can use the 'exists' filter to impose conditions like this:
exists ( matching "IAdaptable" classes containing methods called by ) calls from methods in
recursive derived classes of class "org.eclipse.ui.IEditorPart"
The two approaches are equivalent and the queries will return the same set of calls.
Hi,
I like a lot the idea; but I´ve found myself not getting the point at the syntax. Would be great if the manual has some appendix with bnf grammar for the language, for reference.
Browse by query seems a great idea to me, and it seems we will hear more about it in the future.
Good idea for the manual--
Here's a grammar summary for the current CVS version:
COMPLETE_QUERY : SET_EXPRESSION
| DELIMITED_QUERY
;
SET_EXPRESSION : SET_EXPRESSION SET_OPERATOR SET_EXPRESSION
| '(' SET_EXPRESSION ')'
| VALUE_LIST
| 'execute' SET_EXPRESSION
| 'previous'
| 'unset' nameSymbol
| SAVING_NAME SET_EXPRESSION
| SAVING_NAME TRANSFORM
| VALUE_EXPRESSION SET_EXPRESSION
| SET_EXPRESSION 'that' Identity FILTER
| 'class' literalString
| 'package' literalString
| 'all' 'classes'
| 'all' StringConstant
| 'all' 'packages'
| ImportExpression
| TRANSFORM SET_EXPRESSION
# | [name of a defined set expression]
;
DELIMITED_QUERY : SET_EXPRESSION ';'
| DELIMITED_QUERY ';'
| DELIMITED_QUERY SET_EXPRESSION
;
SET_OPERATOR : 'union'
| 'intersection'
| 'deintersection'
| 'without'
;
VALUE_LIST : '(' ')'
| 'list'
| 'list' VALUE_EXPRESSION
| VALUE_EXPRESSION
| VALUE_LIST ',' VALUE_EXPRESSION
;
SAVING_NAME : 'set' nameSymbol 'to'
;
TRANSFORM : 'same'
| FILTER
| TRANSFORM SET_OPERATOR TRANSFORM
| '(' TRANSFORM ')'
| VALUE_EXPRESSION
| 'recursive' '(' TRANSFORM ')'
| 'recursive' '(' TRANSFORM ',' TRANSFORM ')'
| 'uncorrelated' '(' SET_EXPRESSION ')'
| 'unique'
| VALUE_EXPRESSION TRANSFORM
| TRANSFORM TRANSFORM
| TRANSFORM 'that' Identity FILTER
| 'arguments' 'of'
| 'recursive' 'base' 'classes' 'of'
| 'base' 'classes' 'of'
| 'recursive' 'derived' 'classes' 'of'
| 'derived' 'classes' 'of'
| 'methods' 'in'
| 'fields' 'in'
| 'polymorphic'
| 'calls' 'from'
| Reference 'from'
| StringConstant Reference 'from'
| Reference 'to'
| 'calls' 'to'
| 'fields' 'with'
| 'methods' 'with'
| 'arguments' 'with'
| 'packages' 'in'
| 'classes' 'in'
# | [name of a defined transform]
;
VALUE_EXPRESSION : literalString
| number
| 'to' 'string'
| 'substitute' '(' VALUE_EXPRESSION ',' VALUE_EXPRESSION ')'
| 'substitute' '(' VALUE_EXPRESSION ',' VALUE_EXPRESSION ',' VALUE_EXPRESSION ')'
| GROUP_EXPRESSION
| VALUE_EXPRESSION '&' VALUE_EXPRESSION
| FILTER
| GROUP_EXPRESSION 'of' '(' TRANSFORM ')'
| 'date' '(' literalString ')'
| Types 'of'
| VALUE_EXPRESSION VALUE_EXPRESSION
| StringConstant
| Types
| 'classes' 'containing'
| 'classes' 'with'
| 'methods' 'containing'
| 'methods' 'called' 'by'
| 'fields' 'referenced' 'by'
| StringConstant 'referenced' 'by'
| 'type' 'referenced' 'by'
| 'methods' 'of'
| 'packages' 'of'
;
Identity : 'is'
| 'are'
;
FILTER : 'not' FILTER
| 'exists' '(' TRANSFORM ')'
| '(' FILTER ')'
| FILTER 'and' FILTER
| FILTER 'or' FILTER
| FILTER 'xor' FILTER
| VALUE_EXPRESSION RELATIONAL_OPERATOR VALUE_EXPRESSION
| VALUE_EXPRESSION '~=' VALUE_EXPRESSION
| '~' literalString
| 'matching' literalString
| 'write'
| 'is' 'array'
| 'is' 'reference' 'type'
| 'public'
| 'private'
| 'protected'
| 'package'
| 'abstract'
| 'static'
| 'interface'
| 'deprecated'
| 'uncalled'
| UncalledPolymorphic
;
StringConstant : 'string'
| 'strings'
;
ImportExpression : 'import'
| ImportExpression 'set'
| ImportExpression literalString
;
Reference : 'reference'
| 'references'
;
GROUP_EXPRESSION : 'count'
| 'first'
;
Types : 'type'
| 'types'
;
RELATIONAL_OPERATOR : '<'
| '<='
| '='
| '!='
| '>='
| '>'
;
UncalledPolymorphic : 'uncalled' 'polymorphic'
;
Thanks a Lot, Michael; I know the syntax will vary on next versions, but right now it´ll accelerate learning (at least in my case).
Hi,
This is a great tool. However it would be really useful for me to be able to pass queries on the command line and have the output to stdout rather than from within the gui. This is because I would really like to use it for report generation. Is there anyway to do this?
This is an interesting idea. Browse-by-Query (the standalone version)
include a simple (rudimentary, undocumented) command line interface.
You can start it with the following command:
java -cp bbqstandalone_0.6.3.jar com.antlersoft.analyzer.TestQuery
sample.pj
Where sample.pj is a BBQ database directory, built with one of the other
tools.
You enter queries at the prompt, and they are executed immediately and the
results printed.
There is also a command-line tool for adding classes to a database:
java -cp bbqstandalone_0.6.3.jar com.antlersoft.analyzer.TestAnalyze sample.pj <file>
Where <file> can be a .class file, a .jar (all contained class files and
jars will be added to the database), or a directory (which is traversed and
all contained class files or jars are added to the database).
Is there any way to clear the BBQ database or more importantly remove a project from the database? For instance, I am doing queries on project1 and I now move on to project2, but I do not want my results tainted by possible replicant class/method names in the original project.
Thanks in advance
There is no way to clear specific content from a BBQ database. Best thing to do in your circumstance is to clear the db and rebuild it do what you want. There is a menu command in the UI to clear the db (standalone) or to rebuild the db (eclipse).
Is there a way to filter methods based on exceptions thrown?
Have you considered a graphical display for the sets selected? One interesting possibility would be to have graphs where
+ Nodes are: packages/classes/methods/call points, selected as sets to be presented
+ The layout handles nesting of packages/classes/methods/call points (possibly presenting the container implicitly)
+ Edges are specified as a transform applied to a subset of nodes, with the other end of the transform being added if not present.
I am trying to search for all fields of a certain type. I can use the matching keyword for this but the type I am searching for is a substring of other classes. For example, I am searching for fields matching "Core" and my results might include fields matching "CoreComponent". I know that regular expressions can be used as well, but I can't find a way to specify that I don't want to search for a substring. Is there anything else in BBQ that will allow me to do this? Or does anyone know how to do it in regular expressions?
You can search for fields of a certain type without using the matching operator. To search for a field with type "foo.Bar" use this expression:
fields with type of class "foo.Bar"
It would be very helpful if we had some sort of intellisense (auto completion) on package names, classes, methods and fields while writing queries.