<?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>it.unibz.inf.ontop</groupId>
        <artifactId>ontop-client</artifactId>
        <version>4.2.0</version>
    </parent>

    <artifactId>ontop-protege</artifactId>
    <description>Ontop OBDA plugin for protégé</description>
    <url>http://ontop.inf.unibz.it/</url>

    <organization>
        <name>KRDB Research Centre for Knowledge and Data, Free University of Bozen-Bolzano</name>
        <url>http://www.inf.unibz.it/krdb/</url>
    </organization>

    <properties>
        <symbolic.name>it.unibz.inf.ontop.protege</symbolic.name>
        <finalName>${symbolic.name}-${project.version}</finalName>
        <filter.main.resources>true</filter.main.resources>
        <skipTests>true</skipTests>
    </properties>

    <dependencies>

        <!-- COMPILE DEPENDENCIES (BUNDLE PRIVATE) -->

        <!-- Ontop modules (excl. OWL API, Protégé XML Catalog, duplicate HTTP Client libs) -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-model</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-obda-core</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-rdb</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-mapping-core</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-mapping-sql-core</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-mapping-native</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-mapping-r2rml</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>net.sourceforge.owlapi</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>httpcore-osgi</artifactId>
                    <groupId>org.apache.httpcomponents</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>httpclient-osgi</artifactId>
                    <groupId>org.apache.httpcomponents</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-mapping-sql-all</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-ontology-owlapi</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>net.sourceforge.owlapi</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-mapping-owlapi</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>net.sourceforge.owlapi</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>org.protege.xmlcatalog</artifactId>
                    <groupId>edu.stanford.protege</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-mapping-sql-owlapi</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>net.sourceforge.owlapi</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-system-core</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-system-sql-core</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-system-sql-owlapi</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>net.sourceforge.owlapi</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-owlapi</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>net.sourceforge.owlapi</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>ontop-rdf4j</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>net.sourceforge.owlapi</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Commons RDF -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-rdf-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-rdf-simple</artifactId>
        </dependency>

        <!-- RDF4J -->
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-model</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-turtle</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-ntriples</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-rio-rdfxml</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-query</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-queryparser-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-queryparser-sparql</artifactId>
        </dependency>

        <!-- Jackson -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>

        <!-- Guice -->
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </dependency>

        <!-- Guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>

        <!-- JSR-305 annotation -->
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>

        <!-- Extra dependencies -->
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.thrift</groupId>
            <artifactId>libthrift</artifactId>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <artifactId>javax.annotation-api</artifactId>
                    <groupId>javax.annotation</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.abego.treelayout</groupId>
            <artifactId>org.abego.treelayout.core</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.json</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.ibm.icu</groupId>
            <artifactId>icu4j</artifactId>
            <scope>runtime</scope>
        </dependency>

        <!-- PROVIDED DEPENDENCIES (IMPORTED VIA OSGI FROM PROTÉGÉ) -->

        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.owlapi</groupId>
            <artifactId>owlapi-osgidistribution</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>edu.stanford.protege</groupId>
            <artifactId>protege-editor-core</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <artifactId>semargl-rdfa</artifactId>
                    <groupId>org.semarglproject</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>edu.stanford.protege</groupId>
            <artifactId>protege-editor-owl</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <scope>provided</scope>
        </dependency>
        
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>attach-protege-bundle</id>
                        <phase>${bundle.protege.phase}</phase>
                        <goals>
                            <goal>bundle</goal>
                        </goals>
                        <configuration>
                            <classifier>bundle</classifier>

                            <!-- The following is the set of instructions of how pack the bundle and how to create the
                                 MANIFEST.MF for the bundle. The configuration does 3 things.

                                 1. It makes sure that the "tight" dependencies are not packed as jars, but as .class files
                                    (inline). It makes sure that all the runtime dependencies are packed as jars.

                                 2. It makes sure all the protege plugin resources are packed (plugin.xml, tabs*.xml, etc).

                                 3. It makes sure the META-INF/MANIFEST.MF for OSGi bundles is created with the correct imports,
                                    exports and classpath.
                            -->

                            <instructions>
                                <Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
                                <!-- This makes sure any dependency in the obdalib <dependency> dependencies are packed
                                     as .classes (uncompressed, no jars) and the rest is packed as .jars -->
                                <Embed-Dependency>*;groupId=it.unibz.inf.ontop.*;inline=true,
                                    *;groupId=it.unibz.inf.ontop.protege.*;inline=true,
                                    *;groupId=!it.unibz.inf.ontop;scope=compile|runtime</Embed-Dependency>
                                <Embed-Transitive>true</Embed-Transitive>

                                <!-- necessary for protege plugins -->
                                <Bundle-Category>protege</Bundle-Category>

                                <Bundle-ContactAddress>gh.xiao@gmail.com</Bundle-ContactAddress>
                                <Bundle-DocURL>${project.url}</Bundle-DocURL>
                                <Bundle-Name>Ontop OBDA Protégé plugin</Bundle-Name>
                                <Bundle-Description>${project.description}</Bundle-Description>
                                <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
                                <Implementation-Version>${project.version}</Implementation-Version>
                                <Update-Url>https://github.com/ontop/ontop/raw/master/ontop-protege/update.properties</Update-Url>

                                <Export-Package>
                                    <!-- No need to export any package -->
                                </Export-Package>

                                <Import-Package>!javax.servlet.*,
                                    javax.*,
                                    org.osgi.framework;version="[1.8,2)",
                                    org.slf4j.*;version="[1.7,2)",
                                    org.protege.editor.*;version="[5.5,6)",
                                    org.semanticweb.owlapi.*;version="[4.5,5)",
                                    uk.ac.manchester.cs.owl.owlapi.*;version="[4.5,5)"</Import-Package>

                                <!-- The name of the plugin for OSGi dependencies. It has to be singleton
                                     or protege wont load it -->
                                <Bundle-SymbolicName>${symbolic.name};singleton:=true</Bundle-SymbolicName>

                                <Bundle-Activator>org.protege.osgi.jdbc.JdbcBundleActivator</Bundle-Activator>
                            </instructions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
