Hi Stephen,
On Tue, Oct 29, 2013 at 10:08 PM, Stephen Allen <sal...@apache.org> wrote:
> I have a project that uses schemagen and is built with Maven, so I'm
> definitely interested in this.  What is the main difference between using
> the jena-maven-tools plugin instead of exec-maven-plugin
> + build-helper-maven-plugin [1]?  I use the latter, but if there is a
> better way, I'm all for it.

I've not tried driving schemagen with exec-maven-plugin, so I can't
give a definitive answer. My goal in making an actual maven plugin (in
addition to learning how to do it, which seemed important once upon a
time :) was to make it easy to put the schemagen options declaratively
in the pom. For example, the configuration below shows how to convert
a whole collection of RDF files to Java classes during the translate
goal, and shows that you can set default options for all files and
per-file overrides for individual files. I'd be interested in how that
compares to your current approach (and, specifically, if there are
things you can do now that the plugin doesn't handle).

<build>
  <plugins>
    <plugin>
      <groupId>org.openjena.tools</groupId>
      <artifactId>schemagen</artifactId>
      <version>0.2-SNAPSHOT</version>
      <configuration>
        <includes>
          <include>src/main/vocabs/*.ttl</include>
          <include>src/main/vocabs/foaf.rdf</include>
        </includes>
        <fileOptions>
          <source>
            <input>default</input>
            <package-name>org.example.test</package-name>
          </source>
          <source>
            <!-- Demo2.java (only) will contain OntModel declarations -->
            <input>src/main/vocabs/demo2.ttl</input>
            <ontology>true</ontology>
          </source>
        </fileOptions>
      </configuration>
      <executions>
        <execution>
          <id>schemagen</id>
          <goals>
            <goal>translate</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

Ian

Reply via email to