Add relatedTo feature that allows relationships between projects to be recorded in DOAP files.

git-svn-id: https://svn.apache.org/repos/asf/forrest/trunk@600409 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/whiteboard/plugins/org.apache.forrest.plugin.input.doap/doap.xml b/whiteboard/plugins/org.apache.forrest.plugin.input.doap/doap.xml
index 8837035..715891a 100644
--- a/whiteboard/plugins/org.apache.forrest.plugin.input.doap/doap.xml
+++ b/whiteboard/plugins/org.apache.forrest.plugin.input.doap/doap.xml
@@ -16,7 +16,13 @@
   limitations under the License.
 -->
 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-  xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:doap="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:admin="http://webns.net/mvcb/" xml:lang="en">
+         xmlns:dc="http://purl.org/dc/elements/1.1/" 
+         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
+         xmlns:doap="http://usefulinc.com/ns/doap#" 
+         xmlns:foaf="http://xmlns.com/foaf/0.1/" 
+         xmlns:admin="http://webns.net/mvcb/"
+         xmlns:asfext="http://projects.apache.org/ns/asfext#" 
+         xml:lang="en">
   <doap:Project>
     <doap:name>org.apache.forrest.plugin.input.doap</doap:name>
     <doap:shortname>DOAP</doap:shortname>
@@ -47,5 +53,9 @@
     </doap:repository>
     <foaf:seeAlso rdf:resource="http://forrest.apache.org/pluginDocs/plugins_0_80/org.apache.forrest.plugin.input.doap/changes.rss" dc:format="application/rss+xml" dc:title="DOAP Plugin Recent Changes"/>
     <foaf:seeAlso rdf:resource="http://forrest.apache.org/changes.rss" dc:format="application/rss+xml" dc:title="Forrest Recent Changes"/>
+    
+    <asfext:relatedTo>
+      <doap:Project rdf:resource="http://forrest.apache.org/doap.xml"/>
+    </asfext:relatedTo>
   </doap:Project>
 </rdf:RDF>
diff --git a/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/doap-to-document.xsl b/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/doap-to-document.xsl
index d38c6ab..ea16af2 100644
--- a/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/doap-to-document.xsl
+++ b/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/doap-to-document.xsl
@@ -115,6 +115,7 @@
           </xsl:otherwise>
         </xsl:choose>
       </section>
+      <xsl:call-template name="project-relatedTo"/>
       <xsl:call-template name="project-releases" />
       
       <xsl:if test="foaf:seeAlso[@dc:format='application/rss+xml' or @dc:format='application/atom+xml']">
@@ -416,6 +417,30 @@
       </td>
     </tr>
   </xsl:template>
+  <xsl:template name="project-relatedTo">
+    <xsl:if test="asfext:relatedTo">
+	    <section>
+	      <title>Related To</title>
+	      <ul>
+	        <xsl:for-each select="asfext:relatedTo/doap:Project/doap:name|asfext:relatedTo/doap:Project/atom:feed/atom:entry/atom:content/doap:Project">
+	          <li>
+	            <xsl:choose>
+	              <xsl:when test="doap:homepage">
+	                <a>
+	                  <xsl:attribute name="href"><xsl:value-of select="doap:homepage/@rdf:resource"/></xsl:attribute>
+	                  <xsl:value-of select="doap:name"/>
+	                </a>
+	              </xsl:when>
+	              <xsl:otherwise>
+	                <xsl:value-of select="doap:name"/>
+	              </xsl:otherwise>
+	            </xsl:choose>
+	          </li>
+	        </xsl:for-each>
+	      </ul>
+	    </section>
+    </xsl:if>
+  </xsl:template>
   <xsl:template name="project-releases">
     <section>
       <title>Source and Releases</title>
diff --git a/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/rdf-to-rdfCInclude.xsl b/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/rdf-to-rdfCInclude.xsl
index 5ffb671..182e310 100644
--- a/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/rdf-to-rdfCInclude.xsl
+++ b/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/rdf-to-rdfCInclude.xsl
@@ -41,6 +41,12 @@
       </cinclude:cached-include>
   </xsl:template>
   
+  <xsl:template match="doap:Project/@rdf:resource">
+      <cinclude:cached-include>
+        <xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute>
+      </cinclude:cached-include>
+  </xsl:template>
+  
   <xsl:template match="@*|*|text()|processing-instruction()|comment()">
     <xsl:copy>
       <xsl:apply-templates select="@*|*|text()|processing-instruction()|comment()"/>
diff --git a/whiteboard/plugins/org.apache.forrest.plugin.input.doap/src/documentation/content/xdocs/index.xml b/whiteboard/plugins/org.apache.forrest.plugin.input.doap/src/documentation/content/xdocs/index.xml
index fbff396..6fcd1e9 100644
--- a/whiteboard/plugins/org.apache.forrest.plugin.input.doap/src/documentation/content/xdocs/index.xml
+++ b/whiteboard/plugins/org.apache.forrest.plugin.input.doap/src/documentation/content/xdocs/index.xml
@@ -67,7 +67,7 @@
       <section>
         <title>Multiple Projects</title>
         <p>
-          You can use the projectInfo plugin to pull together project
+          You can use the doap plugin to pull together project
           information for multiple projects. For example, take a look at the
           project details for <a href="projectDetails/forrest.html">Apache
           Forrest</a>.
@@ -205,6 +205,11 @@
       
           <ul>
             <li><a href="exhibitTest.html">Browse the catalogue using Exhibit from MIT</a></li>
+            <li>Record relationships between projects. This is a simple relatedTo property
+            and is not intended to replace detailed build information. 
+            <warning>This feature currently uses a "relatedTo" proeprty that has been
+            placed in the asfext namespace. Hwoever, at the time of writing this addition
+            to the asfext namespace has not been approved.</warning></li>
           </ul>
       </section>
       
diff --git a/whiteboard/plugins/org.apache.forrest.plugin.input.doap/status.xml b/whiteboard/plugins/org.apache.forrest.plugin.input.doap/status.xml
index 06cb387..9173572 100644
--- a/whiteboard/plugins/org.apache.forrest.plugin.input.doap/status.xml
+++ b/whiteboard/plugins/org.apache.forrest.plugin.input.doap/status.xml
@@ -35,6 +35,10 @@
   <changes>
 <!-- Add new releases here -->
     <release version="0.1" date="not-released">
+      <action dev="RDG" type="add" context="code" importance="high">
+        Added relatedTo property to asfExt namespace. This allows us to record a
+        relationship between two projects.
+      </action>
       <action dev="RDG" type="add" context="code" importance="low">
         Support for Exhibit 2.0 
       </action>