<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Panopticode Blog: Tag RDF</title>
    <link>http://blog.panopticode.org/articles/tag/rdf?tag=rdf</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Teaser: Breaking the Build in Panopticode 0.2</title>
      <description>&lt;p&gt;In the &lt;a href="http://blog.panopticode.org/articles/2007/09/12/teaser-creating-ad-hoc-reports-in-panopticode-0-2"&gt;last post&lt;/a&gt; we learned that Panopticode 0.2 will allow us to create arbitrary reports using a SPARQL SELECT query.  Another feature in Panopticode 0.2 is to use a SPARQL ASK query to break the build.&lt;/p&gt;

&lt;p&gt;An ASK query looks very similar to a SELECT but without any elements to return.  If the query matches any data it returns true, otherwise it returns false.&lt;/p&gt;

&lt;p&gt;Rewriting last post&amp;#8217;s SELECT query as an ASK query would look like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; PREFIX rdf: &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;gt;
 PREFIX panopticode: &amp;lt;http://www.panopticode.org/ontologies/panopticode#&amp;gt;
 PREFIX java: &amp;lt;http://www.panopticode.org/ontologies/technology/java#&amp;gt;
 PREFIX emma: &amp;lt;http://www.panopticode.org/ontologies/supplement/emma/1#&amp;gt;
 PREFIX javancss: &amp;lt;http://www.panopticode.org/ontologies/supplement/javancss/1#&amp;gt;

 ASK WHERE
 {
   ?package         rdf:type                       java:Package           .
   ?package         panopticode:name               ?packageName           .
   ?package         java:hasFile                   ?file                  .
   ?file            panopticode:filePath           ?filePath              .
   ?file            java:hasType                   ?class                 .
   ?class           panopticode:name               ?className             .
   ?class           java:hasExecutableMember       ?method                .
   ?method          java:methodSignature           ?methodSignature       .
   ?method          emma:hasLineCoverage           ?lineCoverage          .
   ?method          javancss:cyclomaticComplexity  ?ccn                   .
   ?lineCoverage    emma:coveredPercent            ?lineCoveragePercent   .

   FILTER (?ccn &amp;gt; 1) .
   FILTER (?lineCoveragePercent &amp;lt;= 80.0)
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Panopticode 0.2 will come with an Ant task that automatically breaks the build when an ASK query returns true.&lt;/p&gt;</description>
      <pubDate>Sun, 16 Sep 2007 01:24:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:de421c24-e1cf-4edd-8c13-b7fd5afe9c91</guid>
      <author>Julias Shaw</author>
      <link>http://blog.panopticode.org/articles/2007/09/16/teaser-breaking-the-build-in-panopticode-0-2</link>
      <category>Metrics</category>
      <category>RDF</category>
      <category>SPARQL</category>
      <category>Rules</category>
    </item>
    <item>
      <title>Teaser: Creating Ad Hoc Reports in Panopticode 0.2</title>
      <description>&lt;p&gt;In &lt;a href="http://blog.panopticode.org/articles/2007/02/26/metrics-must-be-interpreted-in-context"&gt;Metrics Must be Interpreted In Context&lt;/a&gt; I 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.&lt;/p&gt;

&lt;p&gt;Panopticode 0.2 has been re-architected to use &lt;a href="http://www.w3.org/RDF/"&gt;RDF&lt;/a&gt; as it&amp;#8217;s file format and internal data store.  This enables you to write queries using &lt;a href="http://www.w3.org/TR/rdf-sparql-query/"&gt;SPARQL&lt;/a&gt;.  Here is a query to find violators of the rule mentioned above:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; PREFIX rdf: &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;gt;
 PREFIX panopticode: &amp;lt;http://www.panopticode.org/ontologies/panopticode#&amp;gt;
 PREFIX java: &amp;lt;http://www.panopticode.org/ontologies/technology/java#&amp;gt;
 PREFIX emma: &amp;lt;http://www.panopticode.org/ontologies/supplement/emma/1#&amp;gt;
 PREFIX javancss: &amp;lt;http://www.panopticode.org/ontologies/supplement/javancss/1#&amp;gt;

 SELECT ?packageName ?filePath ?className ?methodSignature ?ccn ?lineCoveragePercent
 WHERE
 {
   ?package         rdf:type                       java:Package           .
   ?package         panopticode:name               ?packageName           .
   ?package         java:hasFile                   ?file                  .
   ?file            panopticode:filePath           ?filePath              .
   ?file            java:hasType                   ?class                 .
   ?class           panopticode:name               ?className             .
   ?class           java:hasExecutableMember       ?method                .
   ?method          java:methodSignature           ?methodSignature       .
   ?method          emma:hasLineCoverage           ?lineCoverage          .
   ?method          javancss:cyclomaticComplexity  ?ccn                   .
   ?lineCoverage    emma:coveredPercent            ?lineCoveragePercent   .

   FILTER (?ccn &amp;gt; 1) .
   FILTER (?lineCoveragePercent &amp;lt;= 80.0)
 }
 ORDER BY DESC(?ccn) ?lineCoveragePercent ?packageName ?filePath ?className ?methodSignature
&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Wed, 12 Sep 2007 08:12:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:72a2625c-d6c2-4577-8e16-f701beb97918</guid>
      <author>Julias Shaw</author>
      <link>http://blog.panopticode.org/articles/2007/09/12/teaser-creating-ad-hoc-reports-in-panopticode-0-2</link>
      <category>Metrics</category>
      <category>RDF</category>
      <category>SPARQL</category>
    </item>
  </channel>
</rss>
