Commit ebe70467 authored by Sebastien's avatar Sebastien

Add tools to generate automatically java unl class from schema.ttl rdf shema of unl

parent 1d8649c7
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_13" default="false" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/rdf-unl-java-vocabulary.iml" filepath="$PROJECT_DIR$/.idea/rdf-unl-java-vocabulary.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
# Rdf-vocabulary.
Java library of rdfunl schema
It includes rdf schema and the schemagen jena tool to generate java file associated to the rdf schema.
# Requirements.
- Maven 3+
# How to update unl java class from the schema.
1. Install maven 3 or higher (see wiki of your OS)
2. Clone the repository : ```git clone https://gitlab.tetras-libre.fr/unl/rdf-vocabulary.git```
3. Modify the file "rdf-vocabulary/src/main/vocabs/unlVocabulary.ttl"
4. Run command ```mvn package``` to compile and create package
5. Run command ```mvn install``` to install to your local maven repository the package.
# Use the generated jar with maven based project
Insert in the `pom.xml` the following lines
```xml
<dependencies>
...
<dependency>
<groupId>fr.tetras_libre.rdf</groupId>
<artifactId>rdf-unl-java-vocabulary</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
...
</dependencies>
```
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.tetras_libre.rdf</groupId>
<artifactId>rdf-unl-java-vocabulary</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<packaging>jar</packaging>
<name>rdf-unl-java-vocabulary</name>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<target>
<exec
dir="${project.basedir}"
executable="${project.basedir}/src/tools/apache-jena-3.14.0/bin/schemagen"
failonerror="true"
>
<arg line="-i ${project.basedir}/../../schema.ttl -o ${project.basedir}/src/main/java --package fr.tetras_libre.rdf.vocabulary --ontology" />
</exec>
</target>
<!--checking if for windows and non windows OS-->
<target depends="ifOSWindows, ifOSNotWindows" name="checkOS"/>
<condition property="isOSUnix">
<os family="unix" />
</condition>
<condition property="isOSWindows">
<os family="windows" />
</condition>
<!-- if the OS is windows call the target run.script.windows -->
<target name="ifOSWindows" if="isOSWindows">
<echo>is windows........</echo>
<antcall target="runscript.windows"/>
</target>
<!-- if the OS is not windows call the target run.script.unix-->
<target name="ifOSNotWindows" if="isOSUnix">
<echo>is unix........</echo>
<antcall target="runscript.unix"/>
</target>
<target name="runscript.windows">
<echo>This is a Windows machine.</echo>
<exec
dir="${project.basedir}"
executable="${project.basedir}/src/tools/apache-jena-3.14.0/bat/schemagen.bat"
failonerror="true"
>
<arg line="-i ${project.basedir}/../schema.ttl -o ${project.basedir}/src/main/java --package fr.tetras_libre.rdf.vocabulary --ontology -n UNL" />
</exec>
</target>
<target name="runscript.unix">
<echo>This is an Unix machine.</echo>
<exec
dir="${project.basedir}"
executable="${project.basedir}/tools/apache-jena-3.14.0/bin/schemagen"
failonerror="true"
>
<arg line="-i ${project.basedir}/../schema.ttl -o ${project.basedir}/src/main/java --package fr.tetras_libre.rdf.vocabulary --ontology -n UNL" />
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
</configuration>
<executions>
<execution>
<id>generateSources</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<type>pom</type>
<version>3.14.0</version>
</dependency>
</dependencies>
</project>
This diff is collapsed.
This diff is collapsed.
Apache Jena
Copyright 2011-2020 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
This product includes software developed by
PluggedIn Software and under a BSD license.
Portions of this software were originally based on the following:
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP
- Copyright 2010, 2011 Epimorphics Ltd.
- Copyright 2010, 2011 Talis Systems Ltd.
These have been licensed to the Apache Software Foundation under a software grant.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From Apache HttpComponents Client:
This project contains annotations derived from JCIP-ANNOTATIONS
Copyright (c) 2005 Brian Goetz and Tim Peierls. See http://www.jcip.net
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Apache Xerces Java
Copyright 1999-2013 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Portions of this software were originally based on the following:
- software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
- software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
- voluntary contributions made by Paul Eng on behalf of the
Apache Software Foundation that were originally developed at iClick, Inc.,
software copyright (c) 1999.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Simple Logging Facade for Java (SLF4J)
http://slf4j.org/
Copyright (c) 2004-2008 QOS.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Dexx Collections
Copyright (c) 2014 Andrew O'Malley
https://github.com/andrewoma/dexx
BSD-Style License
https://github.com/andrewoma/dexx/blob/master/LICENSE.txt
and includes the following NOTICE
----------
Portions based on code from the Scala standard library.
Copyright (c) 2002-2014 EPFL
Copyright (c) 2011-2014 Typesafe, Inc.
Licensed under BSD-style license (see licenses/LICENSE_Scala.txt)
----------
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Apache Jena
===========
Jena is a Java framework for building semantic web applications. It provides
tools and Java libraries to help you to develop semantic web and linked-data
apps, tools and servers.
This distribution includes the following Apache Jena modules:
- jena-core: provides the Jena RDF APIs, Ontology APIs and Inference APIs.
- jena-arq: SPARQL 1.1, query and update.
- jena-cmds: Command line tools.
- jena-tdb: scalable and performant storage subsystem for Jena
- jena-iri: provides an implementation of RFC 3987 (IRI) and RFC 3986 (URI)
Installing Jena
---------------
To use Jena in your application, ensure all the .jar files in the lib/
directory are on the classpath or available to your web application. Jena
is built and test with these .jar files.
Scripts
-------
The directories bat/ and bin/ provide script wrappers to run Jena command
line tools. The scripts can be copied to a convenient place on the
command path.
To use the Jena tools from the command line you need to set the JENA_HOME
environment variable to point to the location where you have
unzipped the Jena distribution:
Windows:
set JENA_HOME=\path\to\apache-jena-x.y.z
bat\sparql.bat --version
Linux:
The command scripts automatically set JENA_HOME but if you want
to switch to a different version from the same scripts:
export JENA_HOME=/path/to/apache-jena-x.y.z
bin/sparql --version
Where x.y.z is the version of the Jena command line tools you have
downloaded
If you receive a class not found exception when trying to run one of the
scripts then you may have set JENA_HOME incorrectly. A quick and easy way
to validate that JENA_HOME is set correctly is to run the following:
Windows:
cd %JENA_HOME%
Linux:
cd $JENA_HOME
If this command returns an error then JENA_HOME is not pointed to a valid directory
Website
-------
The Apache Jena website is available here:
http://jena.apache.org/
Documentation
-------------
Getting started: http://jena.apache.org/getting_started/
Tutorials: http://jena.apache.org/tutorials/
Documentation: http://jena.apache.org/documentation/
Support is provided via users@jena.apache.org mailing list.
See also: http://jena.apache.org/help_and_support/
Sources and Getting Involved
----------------------------
The Apache Jena source code repository is here:
http://svn.apache.org/repos/asf/jena/
If you are interested in getting involved with Apache Jena development:
http://jena.apache.org/getting_involved/
Licensing
---------
Jena is provided under the Apache Software License v2.0
See LICENSE for the full text.
Cryptographic Software Notice
-----------------------------
This distribution includes cryptographic software. The country in which
you currently reside may have restrictions on the import, possession,
use, and/or re-export to another country, of encryption software. BEFORE
using any encryption software, please check your country's laws,
regulations and policies concerning the import, possession, or use, and
re-export of encryption software, to see if this is permitted.
See <http://www.wassenaar.org/> for more information.
The U.S. Government Department of Commerce, Bureau of Industry and
Security (BIS), has classified this software as Export Commodity
Control Number (ECCN) 5D002.C.1, which includes information security
software using or performing cryptographic functions with asymmetric
algorithms. The form and manner of this Apache Software Foundation
distribution makes it eligible for export under the License Exception
ENC Technology Software Unrestricted (TSU) exception (see the BIS
Export Administration Regulations, Section 740.13) for both object
code and source code.
The following provides more details on the included software that
may be subject to export controls on cryptographic software:
Apache Jena (distribution) includes
Apache HttpComponents Client
Apache HttpComponents Core
which interfaces with the Java Secure Socket Extension (JSSE) API
to provide
- HTTPS support
Apache Jena (distribution) does not include any
implementation of JSSE.
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" arq.arq %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" riotcmd.infer %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" arq.iri %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" arq.juuid %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" riotcmd.nquads %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" riotcmd.ntriples %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" arq.qparse %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" jena.rdfcat %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" jena.rdfcompare %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" jena.rdfcopy %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" arq.rdfdiff %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" jena.rdfparse %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" riotcmd.rdfxml %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" riotcmd.riot %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.
java %JVM_ARGS% -Dlog4j.configuration="%LOGGING%" -cp "%JENA_CP%" arq.rset %*
exit /B
@echo off
@rem Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
if "%JENAROOT%" == "" goto :rootNotSet
set JENA_HOME=%JENAROOT%
:rootNotSet
if NOT "%JENA_HOME%" == "" goto :okHome
echo JENA_HOME not set
exit /B
:okHome
set JENA_CP=%JENA_HOME%\lib\*;
set LOGGING=file:%JENA_HOME%/jena-log4j.properties
@rem JVM_ARGS comes from the environment.