Pellet


Unterpunkte dieser Seite

Links
SVN Checkout
Pellet übersetzen unter Windows XP in der Kommandozeile
Pellet übersetzen unter Windows XP mit Eclipse
Die Pellet Class
Den Jena Source Code einbinden

Links

http://iw.rpi.edu/2007/10/csci6962-jena-pellet.htm
http://wrjih.wordpress.com/category/research/semantic-web/
http://krizik.felk.cvut.cz/km/owldiff/documentation.html
http://www.csc.liv.ac.uk/~frank/publ/publ.html

SVN Checkout

Der Code befindet sich im SVN Repository, welches unter http://owldl.com/svn/pellet erreichbar ist.

Pellet übersetzen unter Windows XP in der Kommandozeile

Um Ant zu installieren muss man Ant herunterladen und dann das Archiv entpacken. Es gibt keine weitere Installationsroutine. JAVA_HOME auf ein JDK setzen, also z.B. C:\Program Files\Java\jdk1.6.0_11. An den PATH ;%JAVA_HOME%\bin anfügen. ANT_HOME auf das Ant Installationsverzeichnis setzen, also z.B. C:\Program Files\apache-ant-1.7.1. CLASSPATH nicht setzen. An PATH ;%ANT_HOME%\bin anhängen. Konsolen schließen und neu öffnen, damit die Umgebungsvariablen in die Konsole übernommen werden. Umgebungsvariablen setzt man mit Control Panel > System > Advanced > Environment Variables > System Variables.

Speichern Sie die build.xml als build_working.xml. Editieren Sie die Datei, damit sie wie folgt aussieht:
<?xml version="1.0"?>
<project name="Pellet" default="dist" basedir=".">
	<description>
    Pellet is a description logic reasoner built for the Web Ontology
    Language (OWL).
  </description>

	<!-- Read user properties -->
	<property file="build.properties"/>
	<property file="${user.home}/build.properties"/>

	<!-- Enviroment -->
	<property environment="env"/>

	<!-- Global Properties -->
	<property name="src" location="src" />
	<property name="test.dir" location="test"/>
	<property name="examples.dir" location="examples"/>
	<property name="javadoc.dir" location="doc/javadoc"/>
	<property name="build" location="build"/>
	<property name="build.class" location="${build}/class" />
	<property name="build.lib" location="${build}/lib" />
	<property name="dist" location="dist" />
	<property name="project.name" value="pellet" />
	<property name="project.version.number" value="1.4" />
	<property name="java_version" value="1.6" />
	<property name="mainclass" value="org.mindswap.pellet.Pellet"/>
	<property name="project.version.file" value="org/mindswap/pellet/version.properties"/>
	<property name="project.version.template" value="${src}/${project.version.file}.in"/>
	<!-- <property name="test.class.name" value="org.mindswap.pellet.CloneProblem" /> -->
	<property name="test.class.name" value="org.mindswap.pellet.MainTestSuite" />
	<property name="test.skip.issues" value="true"/>


	<path id="project.class.path">
		<pathelement location="lib/" />
		<pathelement location="${build.class}" />
		<pathelement location="${examples.dir}"/>
		<pathelement location="${test.dir}"/>
		<fileset dir="lib">
			<include name="**/*.jar"/>
			<exclude name="**/${project.name}*.jar"/>
		</fileset>
	</path>

	<target name="init">
		<!--pathconvert targetos="unix" property="classpath" refid="project.class.path" /-->
		<pathconvert targetos="windows" property="classpath" refid="project.class.path" />
		<echo>CLASSPATH=${classpath}</echo>
		<!-- Create the time stamp -->
		<tstamp/>
		<!-- Create the build directory structure used by compile -->
		<mkdir dir="${build.class}"/>
	</target>

	<target name="compile" depends="init"
      description="Compile source files." >
		<javac source="${java_version}" target="${java_version}" srcdir="${src}" destdir="${build.class}" debug="yes" deprecation="yes">
			<classpath refid="project.class.path"/>
            <!-- <exclude name="org/mindswap/pellet/servlet/Spas2.java"/>-->
		</javac>
		<javac source="${java_version}" target="${java_version}" srcdir="${test.dir}" destdir="${build.class}" debug="yes" deprecation="yes">
			<classpath refid="project.class.path"/>
		</javac>
		<javac source="${java_version}" target="${java_version}" srcdir="${examples.dir}" destdir="${build.class}" debug="yes" deprecation="yes">
			<classpath refid="project.class.path"/>
		</javac>
	</target>

	<target name="build" depends="compile, copy-version-info"
          description="Compile sources and copy data files into build directory.">
		<copy todir="${build.class}">
			<fileset dir="${src}">
				<exclude name="**/*.java" />
			</fileset>
			<fileset dir=".">
				<include name="images/*" />
			</fileset>
		</copy>

		<copy todir="${build.lib}" flatten="true">
			<fileset dir="lib" />
		</copy>
	</target>

	<target name="copy-version-info" depends="label-date">
		<copy file="${project.version.template}" tofile="${build.class}/${project.version.file}" overwrite="true" />
		<echo message="${project.version.label}" />
		<replace file="${build.class}/${project.version.file}">
			<replacefilter token="$$$$VERSION" value="${project.version.label}" />
			<replacefilter token="$$$$DATE" value="${TODAY}" />
		</replace>
	</target>

    <target name="test" depends="build">
      <junit maxmemory="500m" fork="yes" haltonfailure="no">
        <test name="${test.class.name}" />
        <formatter type="plain" usefile="false" />
        <classpath refid="project.class.path"/>
      </junit>
    </target>
 
    <target name="label-date" depends="init">
        <property name="project.version.label"
                  value="${DSTAMP}"/>
        <property name="project.label" 
                  value="${project.name}-${DSTAMP}"/>
    </target>

    <target name="label-nightly" depends="init">
        <property name="project.version.label"
                  value="nightly-build-${DSTAMP}"/>
        <property name="project.label" 
                  value="${project.name}-nightly"/>
    </target>
    
    <target name="label-release" depends="init">
        <property name="project.version.label"
                  value="${project.version.number}"/>
        <property name="project.label" 
                  value="${project.name}-${project.version.number}"/>
    </target>

	<target name="distfiles">
		<!-- Copy in lib files -->
		<mkdir dir="${dist}/lib" />
		<copy todir="${dist}/lib">
			<fileset dir="lib">
				<include name="**/*.jar" />
				<exclude name="**/${project.name}*.jar"/>
			</fileset>
		</copy>

		<!-- Copy in image files" -->
		<!--<mkdir dir="${dist}/images"/>
    <copy todir="${dist}/images">
      <fileset dir="images">
        <include name="**/*"/>
      </fileset>
    </copy>
    -->

		<!-- Copy base files in -->
		<copy todir="${dist}">
			<fileset dir="" includes="README.txt LICENSE.txt CHANGES.txt build.xml">
				<include name="pellet.properties"/>
				<include name="pellet*.bat"/>
				<include name="pellet*.sh"/>
				<include name="doc/**"/>
				<include name="examples/**"/>
				<include name="src/**"/>
				<include name="test/**"/>
			</fileset>
		</copy>
	</target>

	<target name="dist" depends="build,distfiles"
          description="Generate a distribution" >
		<!-- Generate relative classpath for jar file -->
		<property name="lib" location="${basedir}/lib/"/>
		<pathconvert dirsep="/" pathsep=" " property="Class-Path">
			<map from="${lib}/" to=""/>
			<map from="${lib}\" to=""/>
			<!--" (dumb vim problem with quotes)-->
			<path>
				<fileset dir="lib">
					<include name="**/*.jar" />
				</fileset>
			</path>
		</pathconvert>

		<!-- Make Jar file. -->
		<jar jarfile="${dist}/lib/${project.name}.jar"
       basedir="${build.class}">
			<manifest>
				<attribute name="Main-Class" value="${mainclass}"/>
				<attribute name="Class-Path" value="${Class-Path}" />
			</manifest>
		</jar>
	</target>

	<target name="war" depends="build,distfiles">
		<war destfile="${dist}/${project.name}.war" webxml="web/WEB-INF/web.xml">
			<classes dir="${build.class}" />
			<lib dir="${build.lib}">
				<exclude name="servlet.jar"/>
			</lib>
			<webinf dir="web/WEB-INF" excludes="web.xml"/>
			<zipfileset dir="web" excludes="WEB-INF/**"/>
		</war>
	</target>

	<target name="zipfile" depends="label-date,dist,javadoc"
          description="Build a zipfile containing source and binaries.">
		<condition property="project.dirname"
           value="${project.name}-${DSTAMP}">
			<not>
				<isset property="project.dirname"/>
			</not>
		</condition>
		<!-- Copy the javadocs -->
		<copy todir="${dist}">
			<fileset dir="">
				<include name="doc/**"/>
			</fileset>
		</copy>
		<zip destfile="${dist}/${project.dirname}.zip">
			<zipfileset dir="dist" prefix="${project.dirname}"
            excludes="${project.name}*.zip"/>
		</zip>
	</target>

	<target name="javadoc" depends="build">
		<javadoc destdir="${javadoc.dir}" access="public" use="true" notree="false" nonavbar="false" 
    noindex="false" splitindex="true" author="true" version="true" nodeprecatedlist="false" 
    nodeprecated="false" 
    sourcepath="${src}" 
    packagenames="org.mindswap.pellet.*"  
    doctitle="${project.name}-${project.version.label}"
    bottom="Copyright © 2004 Evren Sirin. All Rights Reserved.">
			<classpath refid="project.class.path"/>
		</javadoc>
	</target>

	<target name="release" depends="label-release">
		<property name="project.dirname" 
              value="${project.name}-${project.version.label}" />
		<antcall target="zipfile"/>
	</target>

	<target name="nightly-release" depends="label-nightly">
		<property name="project.dirname"
              value="${project.name}-nightly" />
		<antcall target="zipfile"/>
	</target>

	<target name="clean" description="Clean up build files">
		<delete dir="${build}" />
		<delete dir="${dist}" />
		<delete dir="${javadoc.dir}" />
	</target>
</project>



Führen Sie
ant -f build_working.xml
aus. Im Ordner pellet\trunk\dist ist nun eine eigene Distribution entstanden.

Pellet übersetzen unter Windows XP mit Eclipse

Mit Subclipse
Install SVN Subclipse Plugin.
Help > Software Updates > Reiter Available Software > Add Site > Verwenden Sie dann als Archiv Site das Zip Archiv von der Subversion homepage.

Im Package Explorer Import > SVN > Check out Projects from SVN auswählen > Create New Repository Location > http://owldl.com/svn/pellet > Next > Die Projekte sind nun im Workspace.
Mit Tortoise
Man checkt das Repository mit Tortoise in ein Verzeichnis (z.B. pellet) im workspace aus. File > New > Project from existing ant buildfile > select the build.xml ant file in the trunk folder.

Die Pellet Class

Die Pellet Klasse besitzt die main Methode und bietet in dieser main Methode ein Kommandozeileninterface per Aufrufparameter an. Die Kommandozeilenparameter sind hier aufgelistet:
Pellet - OWL DL Reasoner (Version:(unreleased))
For the OWL ontologies Pellet provides options find the ontology level
(Lite, DL, FULL), check consistency, find unsatisfiable concepts, 
display class hierarchy, save OWL Full ontologies as OWL DL, 
check if triples in another ontology is entailed by the input
ontology


Usage: java Pellet OPTIONS
OPTIONS
Parameter Bedeutung
{-if,-inputFile} <file URI> Input ontology URI
{-is,-inputString} string A string representation of the input file
{-ifmt,-inputFormat} format Format of the input file, one of [RDF/XML, N3, N-TRIPLE]
{-s,-species} {on,level,off} Turn on/off species validation (Default: on). The option "level" means species validation will be done but no detailed report is printed
-consistency {on,off} Turn on/off consistency checking (Default: on) Note that any reasoning service (classification realization,query) will turn this option on
-unsat Find the unsatisfiable classes in the ontology. This option is unnecessary if classification is selected
{-c,-classify} [format] Classify the ontology and display the hierarchy in one of the formats [TREE, RDF, RDF-ALL]. If realize option is selected, types for individuals are also printed (Default format: TREE) TREE: Display the hierarchy as an indented tree RDF: Display only direct subclasses in RDF/XML RDF-ALL: Display all subclasses in RDF/XML
{-r,-realize} Compute and display the most specific instances for each class. When this option is enabled, classification will be automatically done
{-cf,-conclusionsFile} Check if all the triples in this ontology is entailed by the input ontology
{-cs,-conclusionsString} str A string representation of the conclusions file
-conclusionsFormat format Format of the conclusions file, one of [RDF/XML, N3, NTRIPLES]
{-qf,-queryFile} file Read the SPARQL (or RDQL) query from the given file and run it on the input ontology
{-qs,-queryString} string Run the given query on the input ontology
{-qfmt,-queryFormat} format Specify the format of the query (Default: SPARQL)
-dlsafe Enable processing DL-safe rules found in the input file
-econn Enable processing for E-Connected ontologies. Should not be used if the input ontology is not E-connected
-timeout time Timeout after
-timing Print detailed timing information
-version Print the version information and exit
-help Print help message

Den Jena Source Code einbinden

In Eclipse ist es möglich einer Jar File SourceCode zuzuordnen, so das man in die Jar file Debuggen und den SourceCode im Eclipse Editor betrachten kann. Im ersten Schritt muss der SourceCode beschafft werden. Im zweiten Schritt trägt man den Source Code in Eclipse und dort in der Jar File des Build Paths des Projekts als Source Code ein.

Jena ist durch ein CVS Repository erreichbar. Installieren Sie Tortoise CVS. The modules available are browsed via http://jena.cvs.sourceforge.net/viewvc/jena/ or you can view them via tortoise cvs by clicking Fetch List ... Erstellen Sie ein Verzeichnis jena im workspace. Checken Sie das Modul jena2 (nicht jena) in dieses Verzeichnis aus. In Eclipse erzeugen Sie nun ein Projekt für den jena2 source code. File > New > Project from existing ant buildfile > select the build.xml ant file in the jena2 folder.

Markieren Sie nun das Pellet Projekt in Eclipse > Properties > Java Build Path > Reiter Libraries > Öffnen Sie jena.jar durch das Plus Symbol > Markieren Sie Source Code attachement > Edit > Workspace (Da Sie den Source Code von Jena2 in den workspace ausgecheckt haben) > markieren Sie den Ordner jena/jena2 > Ok.

Wenn Sie nun eine Klasse aus dem JenaSource Code aus dem Pellet Projekt heraus betrachten, zeigt eclipse den jena2 source code an.


zum Seitenanfang
zur Hauptseite

Letzte Änderung: 23.03.2009