-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added parent pom that encapsulates the dcat generation
- Loading branch information
Showing
1 changed file
with
301 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,301 @@ | ||
<?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> | ||
<groupId>org.aksw.data.config</groupId> | ||
<artifactId>dcat-generator</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<!-- Deploy this pom itself by deactivating the default profile: | ||
mvn -P'!default,release' deploy | ||
--> | ||
|
||
<parent> | ||
<groupId>org.aksw.data.config</groupId> | ||
<artifactId>aksw-data-deployment</artifactId> | ||
<version>0.0.8</version> | ||
<relativePath></relativePath> | ||
</parent> | ||
|
||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<!-- Child pom must define the following properties: --> | ||
<!-- | ||
<input.groupId>${IN_GROUPID}</input.groupId> | ||
<input.artifactId>${IN_ARTIFACTID}</input.artifactId> | ||
<input.version>${IN_VERSION}</input.version> | ||
<input.type>${IN_TYPE}</input.type> | ||
--> | ||
|
||
<output.type>ttl.bz2</output.type> | ||
<output.classifier>dcat</output.classifier> | ||
<output.path>${project.build.directory}/${project.artifactId}-${output.classifier}.${output.type}</output.path> | ||
|
||
|
||
<input.urn.base>urn:mvn:${input.groupId}:${input.artifactId}:${input.version}</input.urn.base> | ||
<input.urn.file>${input.urn.base}:${input.type}</input.urn.file> | ||
<input.urn.dataset>${input.urn.base}#dataset</input.urn.dataset> | ||
<input.urn.distribution>${input.urn.data}#distribution</input.urn.distribution> | ||
|
||
<input.urn.void>${input.urn.dataset}/void</input.urn.void> | ||
|
||
<input.urn.pom>${input.urn.base}:pom</input.urn.pom> | ||
<input.urn.data>${input.urn.base}:${input.type}</input.urn.data> | ||
|
||
<input.urn.activity>${input.urn.data}#activity</input.urn.activity> | ||
<input.urn.plan>${input.urn.data}#plan</input.urn.plan> | ||
|
||
<output.urn.base>urn:mvn:${project.groupId}:${project.artifactId}:${project.version}</output.urn.base> | ||
|
||
<output.urn.pom>${output.urn.base}:pom</output.urn.pom> | ||
<output.urn.data>${output.urn.base}:${output.type}</output.urn.data> | ||
<output.urn.activity>${output.urn.base}#activity</output.urn.activity> | ||
|
||
<datasetDirectory>${project.build.directory}/datasets</datasetDirectory> | ||
<input.data.path>${datasetDirectory}/${input.artifactId}.${input.type}</input.data.path> | ||
<input.pom.path>${datasetDirectory}/${input.artifactId}.pom</input.pom.path> | ||
|
||
|
||
<jenax.version>5.0.0-1-SNAPSHOT</jenax.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.aksw.jenax</groupId> | ||
<artifactId>jenax-resources-prefixes</artifactId> | ||
<version>${jenax.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<profiles> | ||
<profile> | ||
<id>default</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<build> | ||
<resources> | ||
<resource> | ||
<directory>${project.build.directory}/datasets</directory> | ||
</resource> | ||
</resources> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>resource-dependencies</id> | ||
<phase>process-resources</phase> | ||
<goals> | ||
<goal>copy</goal> | ||
</goals> | ||
<configuration> | ||
<localRepositoryDirectory> | ||
${project.build.directory}/cache</localRepositoryDirectory> | ||
<stripVersion>true</stripVersion> | ||
<artifactItems> | ||
|
||
<artifactItem> | ||
<groupId>${input.groupId}</groupId> | ||
<artifactId>${input.artifactId}</artifactId> | ||
<version>${input.version}</version> | ||
<type>pom</type> | ||
<overWrite>true</overWrite> | ||
<outputDirectory>${datasetDirectory}</outputDirectory> | ||
</artifactItem> | ||
|
||
<artifactItem> | ||
<groupId>${input.groupId}</groupId> | ||
<artifactId>${input.artifactId}</artifactId> | ||
<version>${input.version}</version> | ||
<type>${input.type}</type> | ||
<overWrite>true</overWrite> | ||
<outputDirectory>${datasetDirectory}</outputDirectory> | ||
</artifactItem> | ||
|
||
</artifactItems> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.aksw.maven.plugins</groupId> | ||
<artifactId>sparql-maven-plugin</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<executions> | ||
<execution> | ||
<id>generate-metadata</id> | ||
<phase>process-resources</phase> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<configuration> | ||
<outputFile>${output.path}</outputFile> | ||
<outputFormat>${output.type}</outputFormat> | ||
<env> | ||
<B>${input.urn.void}</B> | ||
<D>${input.urn.dataset}</D> | ||
|
||
<BASE>$input.urn.base}#</BASE> | ||
<POM>${input.pom.path}</POM> | ||
</env> | ||
<args> | ||
<arg>${input.data.path}</arg> | ||
|
||
<arg>void/sportal/compact/qbAllBut2.rq</arg> | ||
<arg>void/sportal/compact/qb2.rq</arg> | ||
|
||
<arg>void/sportal/compact/qcAllBut35.rq</arg> | ||
<arg>void/sportal/compact/qc3.rq</arg> | ||
<arg>void/sportal/compact/qc5.rq</arg> | ||
|
||
<arg>void/sportal/compact/qdAll.rq</arg> | ||
<arg>void/sportal/compact/qeAll.rq</arg> | ||
|
||
<arg>void/sportal/compact/qf1.rq</arg> | ||
<arg>void/sportal/compact/qf2.rq</arg> | ||
<arg>void/sportal/compact/qf3.rq</arg> | ||
<arg>void/sportal/compact/qf4.rq</arg> | ||
<arg>void/sportal/compact/qf5.rq</arg> | ||
<arg>void/sportal/compact/qf6.rq</arg> | ||
<arg>void/sportal/compact/qf7.rq</arg> | ||
<arg>void/sportal/compact/qf8.rq</arg> | ||
<arg>void/sportal/compact/qf9.rq</arg> | ||
<arg>void/sportal/compact/qf10.rq</arg> | ||
|
||
<arg>void/sportal/compact/qx1.rq</arg> | ||
|
||
<!-- TODO Make this pom.xml itself accessible from sparql so that we can create a PROVO model about which sparql queries were run --> | ||
|
||
<arg> | ||
rdf-prefixes/prefix.cc.2019-12-17.ttl</arg> | ||
<arg><![CDATA[ | ||
CONSTRUCT { | ||
<${input.urn.dataset}> | ||
a dcat:Dataset ; | ||
prov:wasGeneratedBy <${input.urn.activity}> ; | ||
dcat:distribution <${input.urn.distribution}> ; | ||
. | ||
<${input.urn.distribution}> | ||
dcat:downloadURL <${input.urn.file}> ; | ||
. | ||
<${input.urn.activity}> | ||
prov:hadPlan <${input.urn.plan}> ; | ||
. | ||
<${input.urn.plan}> | ||
a eg:MavenBuild ; | ||
eg:urn <${input.urn.pom}> ; | ||
. | ||
} WHERE { } | ||
]]></arg> | ||
|
||
<arg><![CDATA[ | ||
PREFIX norse: <https://w3id.org/aksw/norse#> | ||
PREFIX dcat: <http://www.w3.org/ns/dcat#> | ||
PREFIX foaf: <http://xmlns.com/foaf/0.1/> | ||
PREFIX org: <http://www.w3.org/ns/org#> | ||
PREFIX dct: <http://purl.org/dc/terms/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX ex: <http://example.org/resource/> | ||
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | ||
CONSTRUCT { ?s ?p ?o } | ||
WHERE { | ||
BIND(<env:BASE> AS ?base) | ||
BIND(<env:D> AS ?datasetIdStr) | ||
BIND(IRI(?datasetIdStr) AS ?datasetId) | ||
BIND(<env:POM> AS ?input) | ||
BIND(norse:xml.parse(?input) AS ?xml) | ||
LATERAL { | ||
{ | ||
BIND(dct:license AS ?p) | ||
?xml norse:xml.unnest ("/*/:licenses/:license" ?license) . | ||
BIND(IRI(norse:xml.path(?license, "/*/:url/text()")) AS ?licenseUrl) | ||
BIND(?datasetId AS ?s) | ||
LATERAL { | ||
{ | ||
BIND(?licenseUrl AS ?o) | ||
} | ||
#UNION { | ||
# BIND(norse:xml.path(?license, "//:name") AS ?licenseName) | ||
#} | ||
} | ||
} | ||
UNION | ||
{ | ||
?xml norse:xml.unnest ("/*/:developers/:developer" ?dev) . | ||
BIND(norse:xml.path(?dev, "/*/:name/text()") AS ?devName) | ||
BIND(norse:xml.path(?dev, "/*/:url/text()") AS ?devUrl) | ||
BIND(IRI(CONCAT(?base, 'dev/', ENCODE_FOR_URI(COALESCE(STR(?devUrl), ?devName)))) AS ?devId) | ||
BIND(norse:xml.path(?dev, "/*/:organization/text()") AS ?devOrgName) | ||
BIND(IRI(norse:xml.path(?dev, "/*/:organizationUrl/text()")) AS ?devOrgUrl) | ||
BIND(IRI(CONCAT(?base, 'org/', ENCODE_FOR_URI(COALESCE(STR(?devOrgUrl), ?devOrgName)))) AS ?devOrgId) | ||
LATERAL { | ||
{ BIND(?datasetId AS ?s) BIND(dcat:contributor AS ?p) BIND(?devId AS ?o) } | ||
UNION | ||
{ BIND(?devId AS ?s) BIND(foaf:name AS ?p) BIND(?devName AS ?o) } | ||
UNION | ||
{ BIND(?devId AS ?s) BIND(org:memberOf AS ?p) BIND(?devOrgId AS ?o) } | ||
UNION | ||
{ BIND(?devOrgId AS ?s) BIND(rdfs:label AS ?p) BIND(?devOrgName AS ?o) } | ||
UNION | ||
{ BIND(?devOrgId AS ?s) BIND(eg:website AS ?p) BIND(?devOrgUrl AS ?o) } | ||
} | ||
} | ||
} | ||
} | ||
]]> | ||
</arg> | ||
|
||
<!-- <arg><![CDATA[SELECT (COUNT(*) AS ?c) { ?s ?p ?o }]]></arg> --> | ||
</args> | ||
</configuration> | ||
</execution> | ||
<!-- Ugly hack to move all data into a graph that matches this artifact --> | ||
<!-- <execution> <id>postprocess-metadata</id> <phase>process-resources</phase> <goals> <goal>run</goal> </goals> <configuration> <outputFile>${output.path}</outputFile> <args> <arg>${output.path}</arg> <arg> <![CDATA[ DELETE { ?s ?p ?o } INSERT { GRAPH <${output.urn.base}> { ?s ?p ?o } } WHERE { ?s ?p ?o } ]]> </arg> </args> </configuration> </execution> --> | ||
|
||
|
||
</executions> | ||
</plugin> | ||
<!-- Declare that the output file of the data generator should become part of this artifact --> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>attach-artifacts</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>attach-artifact</goal> | ||
</goals> | ||
<configuration> | ||
<artifacts> | ||
<artifact> | ||
<file>${output.path}</file> | ||
<classifier>${output.classifier}</classifier> | ||
<type>${output.type}</type> | ||
</artifact> | ||
</artifacts> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |