Skip to content

Commit

Permalink
Merge pull request #5 from fcrepo4/update-and-mavenize
Browse files Browse the repository at this point in the history
Adding Maven pom for xslt, bringing ontologies in line with predicates used by fcrepo4
  • Loading branch information
Andrew Woods committed Jul 27, 2014
2 parents f5a6398 + b9c75bd commit bb569b8
Show file tree
Hide file tree
Showing 8 changed files with 494 additions and 288 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@
catalog-v001.xml
# ignore Mac OS Finder files
.DS_Store
target
6 changes: 6 additions & 0 deletions README
Expand Up @@ -3,3 +3,9 @@ v4 Ontology for Fedora Commons.
http://fedora.info/definitions/v4/repository
http://fedora.info/definitions/v4/rels-ext
http://fedora.info/definitions/v4/rest-api

To generate HTML versions of the ontologies:

```sh
$ mvn xml:transform
```
5 changes: 5 additions & 0 deletions index.xml
@@ -0,0 +1,5 @@
<index title="Fedora Ontologies">
<page id="rels-ext"/>
<page id="repository"/>
<page id="rest-api"/>
</index>
25 changes: 24 additions & 1 deletion owl2html.xsl
Expand Up @@ -7,7 +7,7 @@
<xsl:output method="html"/>
<xsl:variable name="title" select="/rdf:RDF/owl:Ontology/rdfs:label"/>
<xsl:variable name="about" select="/rdf:RDF/owl:Ontology/@rdf:about"/>
<xsl:template match="/">
<xsl:template match="/rdf:RDF">
<html>
<head>
<title><xsl:value-of select="$title"/></title>
Expand Down Expand Up @@ -153,4 +153,27 @@
</xsl:if>
</div>
</xsl:template>
<xsl:template match="/index">
<html>
<head>
<title><xsl:value-of select="@title"/></title>
<style>
h1 { font-size: large; }
body { font-family: sans-serif; }
</style>
</head>
<body>
<h1><xsl:value-of select="@title"/></h1>
<ul>
<xsl:for-each select="page">
<xsl:variable name="page_id" select="@id"/>
<xsl:for-each select="document(concat($page_id,'.rdf'))">
<xsl:variable name="title" select="rdf:RDF/owl:Ontology/rdfs:label"/>
<li><a href="{$page_id}/"><xsl:value-of select="$title"/></a></li>
</xsl:for-each>
</xsl:for-each>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
67 changes: 67 additions & 0 deletions pom.xml
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo</artifactId>
<version>4.0.0-beta-02-SNAPSHOT</version>
</parent>

<artifactId>fcrepo-ontology</artifactId>
<name>${project.artifactId}</name>
<description>Fedora Ontology</description>
<packaging>pom</packaging>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<dir>.</dir>
<includes>
<include>rels-ext.rdf</include>
<include>repository.rdf</include>
<include>rest-api.rdf</include>
</includes>
<stylesheet>owl2html.xsl</stylesheet>
<outputDir>${project.build.directory}/html</outputDir>
<fileMappers>
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
<pattern>\.rdf$</pattern>
<replacement>/index.html</replacement>
</fileMapper>
</fileMappers>
</transformationSet>
<transformationSet>
<dir>.</dir>
<includes>
<include>index.xml</include>
</includes>
<stylesheet>owl2html.xsl</stylesheet>
<outputDir>${project.build.directory}/html</outputDir>
<fileMappers>
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>

</transformationSets>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

0 comments on commit bb569b8

Please sign in to comment.