{"id":56,"date":"2007-09-12T09:49:21","date_gmt":"2007-09-12T16:49:21","guid":{"rendered":"http:\/\/www.juliasshaw.com\/blog\/?p=56"},"modified":"2007-09-12T09:49:21","modified_gmt":"2007-09-12T16:49:21","slug":"teaser-creating-ad-hoc-reports-in-panopticode-02","status":"publish","type":"post","link":"http:\/\/www.juliasshaw.com\/blog\/2007\/09\/12\/teaser-creating-ad-hoc-reports-in-panopticode-02\/","title":{"rendered":"Teaser: Creating Ad Hoc Reports in Panopticode 0.2"},"content":{"rendered":"<div class=\"post_details\">\n<div class=\"post_body\">\n<p>In\u00a0<a href=\"http:\/\/www.juliasshaw.com\/blog\/2007\/02\/26\/metrics-must-be-interpreted-in-context\/\">Metrics Must be Interpreted In Context<\/a>\u00a0I described one of my preferences when creating rules around metrics. Namely, that one should not look at metrics independently, but within the context of other metrics. I described a rule that said unit test line coverage must be greater then 80% for all code with a cyclomatic complexity over 1. While you could enforce this rule in Panopticode 0.1 by creating a custom report, this is not ideal. Who wants to write Java code every time you make a new rule? This will get much easier in Panopticode 0.2.<\/p>\n<p>Panopticode 0.2 has been re-architected to use\u00a0<a href=\"http:\/\/www.w3.org\/RDF\/\">RDF<\/a>\u00a0as it\u2019s file format and internal data store. This enables you to write queries using\u00a0<a href=\"http:\/\/www.w3.org\/TR\/rdf-sparql-query\/\">SPARQL<\/a>. Here is a query to find violators of the rule mentioned above:<\/p>\n<pre><code> PREFIX rdf: &lt;http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#&gt;\n PREFIX panopticode: &lt;http:\/\/www.panopticode.org\/ontologies\/panopticode#&gt;\n PREFIX java: &lt;http:\/\/www.panopticode.org\/ontologies\/technology\/java#&gt;\n PREFIX emma: &lt;http:\/\/www.panopticode.org\/ontologies\/supplement\/emma\/1#&gt;\n PREFIX javancss: &lt;http:\/\/www.panopticode.org\/ontologies\/supplement\/javancss\/1#&gt;\n\n SELECT ?packageName ?filePath ?className ?methodSignature ?ccn ?lineCoveragePercent\n WHERE\n {\n   ?package         rdf:type                       java:Package           .\n   ?package         panopticode:name               ?packageName           .\n   ?package         java:hasFile                   ?file                  .\n   ?file            panopticode:filePath           ?filePath              .\n   ?file            java:hasType                   ?class                 .\n   ?class           panopticode:name               ?className             .\n   ?class           java:hasExecutableMember       ?method                .\n   ?method          java:methodSignature           ?methodSignature       .\n   ?method          emma:hasLineCoverage           ?lineCoverage          .\n   ?method          javancss:cyclomaticComplexity  ?ccn                   .\n   ?lineCoverage    emma:coveredPercent            ?lineCoveragePercent   .\n\n   FILTER (?ccn &gt; 1) .\n   FILTER (?lineCoveragePercent &lt;= 80.0)\n }\n ORDER BY DESC(?ccn) ?lineCoveragePercent ?packageName ?filePath ?className ?methodSignature<\/code><\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to create custom reports in Panopticode 0.2 that correlate information between multiple metrics using SPARQL queries. <a href=\"http:\/\/www.juliasshaw.com\/blog\/2007\/09\/12\/teaser-creating-ad-hoc-reports-in-panopticode-02\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[17,18,19,25],"class_list":["post-56","post","type-post","status-publish","format-standard","hentry","category-categories-suck-tags-rule","tag-metrics","tag-open-source","tag-panopticode","tag-technology"],"_links":{"self":[{"href":"http:\/\/www.juliasshaw.com\/blog\/wp-json\/wp\/v2\/posts\/56","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.juliasshaw.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.juliasshaw.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.juliasshaw.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.juliasshaw.com\/blog\/wp-json\/wp\/v2\/comments?post=56"}],"version-history":[{"count":0,"href":"http:\/\/www.juliasshaw.com\/blog\/wp-json\/wp\/v2\/posts\/56\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.juliasshaw.com\/blog\/wp-json\/wp\/v2\/media?parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.juliasshaw.com\/blog\/wp-json\/wp\/v2\/categories?post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.juliasshaw.com\/blog\/wp-json\/wp\/v2\/tags?post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}