From: <ku...@us...> - 2011-10-23 13:50:41
|
Revision: 3316 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3316&view=rev Author: kurzum Date: 2011-10-23 13:50:34 +0000 (Sun, 23 Oct 2011) Log Message: ----------- example of OLiA mapping Modified Paths: -------------- trunk/components-ext/pom.xml Added Paths: ----------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/util/NifExamples.java Modified: trunk/components-ext/pom.xml =================================================================== --- trunk/components-ext/pom.xml 2011-10-20 18:58:19 UTC (rev 3315) +++ trunk/components-ext/pom.xml 2011-10-23 13:50:34 UTC (rev 3316) @@ -1,184 +1,190 @@ <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> + 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.dllearner</groupId> - <artifactId>components-ext</artifactId> - <packaging>jar</packaging> + <groupId>org.dllearner</groupId> + <artifactId>components-ext</artifactId> + <packaging>jar</packaging> - <name>components-ext</name> - <url>http://aksw.org/Projects/DLLearner</url> + <name>components-ext</name> + <url>http://aksw.org/Projects/DLLearner</url> - <repositories> - <repository> - <id>Simmetrics</id> - <url>http://maven.mse.jhu.edu/m2repository/</url> - </repository> - <!-- <repository> <id>Harvard Med</id> <url>http://repo.open.med.harvard.edu/nexus/content/repositories/public/</url> - </repository> --> - <repository> - <id>Annolab</id> - <url>http://annolab.org/m2/releases/</url> - </repository> - <!-- <repository> <id>Mirror for WSTX</id> <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url> - </repository> --> - </repositories> + <repositories> + <repository> + <id>Simmetrics</id> + <url>http://maven.mse.jhu.edu/m2repository/</url> + </repository> + <!-- <repository> <id>Harvard Med</id> <url>http://repo.open.med.harvard.edu/nexus/content/repositories/public/</url> + </repository> --> + <repository> + <id>Annolab</id> + <url>http://annolab.org/m2/releases/</url> + </repository> + <!-- <repository> <id>Mirror for WSTX</id> <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url> + </repository> --> + </repositories> - <parent> - <groupId>org.dllearner</groupId> - <artifactId>dllearner-parent</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - <dependencies> - <dependency> - <groupId>org.dllearner</groupId> - <artifactId>components-core</artifactId> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>com.jamonapi</groupId> - <artifactId>jamon</artifactId> - </dependency> - <dependency> - <groupId>org.aksw.commons</groupId> - <artifactId>sparql</artifactId> - </dependency> - <dependency> - <groupId>org.apache.solr</groupId> - <artifactId>solr-core</artifactId> - <version>3.3.0</version> - <type>jar</type> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>1.6.0</version> - </dependency> - <dependency> - <groupId>edu.stanford</groupId> - <artifactId>postagger</artifactId> - <version>3.0.2</version> - </dependency> - <dependency> - <groupId>lbj</groupId> - <artifactId>library</artifactId> - <version>1.0</version> - </dependency> - <dependency> - <groupId>lbj</groupId> - <artifactId>core</artifactId> - <version>1.0</version> - </dependency> - <dependency> - <groupId>lbj</groupId> - <artifactId>ner</artifactId> - <version>1.0</version> - </dependency> - <dependency> - <groupId>jaws</groupId> - <artifactId>core</artifactId> - <version>1.0</version> - </dependency> - <dependency> - <groupId>uk.ac.shef.wit</groupId> - <artifactId>simmetrics</artifactId> - <version>1.6.2</version> - <type>jar</type> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>stax</groupId> - <artifactId>stax-api</artifactId> - <version>1.0.1</version> - <type>jar</type> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>woodstox</groupId> - <artifactId>wstx-api</artifactId> - <version>3.2.0</version> - <type>jar</type> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.opennlp</groupId> - <artifactId>opennlp-tools</artifactId> - <version>1.5.1-incubating</version> - </dependency> - <dependency> - <groupId>org.apache.opennlp</groupId> - <artifactId>opennlp-maxent</artifactId> - <version>3.0.1-incubating</version> - </dependency> - <dependency> - <groupId>com.aliasi</groupId> - <artifactId>lingpipe</artifactId> - <version>4.0.1</version> - </dependency> - <dependency> - <groupId>org.annolab.tt4j</groupId> - <artifactId>org.annolab.tt4j</artifactId> - <version>1.0.14</version> - </dependency> + <parent> + <groupId>org.dllearner</groupId> + <artifactId>dllearner-parent</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <dependencies> + <dependency> + <groupId>org.dllearner</groupId> + <artifactId>components-core</artifactId> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.jamonapi</groupId> + <artifactId>jamon</artifactId> + </dependency> + <dependency> + <groupId>org.aksw.commons</groupId> + <artifactId>sparql</artifactId> + </dependency> + <dependency> + <groupId>org.apache.solr</groupId> + <artifactId>solr-core</artifactId> + <version>3.3.0</version> + <type>jar</type> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.6.0</version> + </dependency> + <dependency> + <groupId>edu.stanford</groupId> + <artifactId>postagger</artifactId> + <version>3.0.2</version> + </dependency> + <dependency> + <groupId>lbj</groupId> + <artifactId>library</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>lbj</groupId> + <artifactId>core</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>lbj</groupId> + <artifactId>ner</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>jaws</groupId> + <artifactId>core</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>uk.ac.shef.wit</groupId> + <artifactId>simmetrics</artifactId> + <version>1.6.2</version> + <type>jar</type> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>stax</groupId> + <artifactId>stax-api</artifactId> + <version>1.0.1</version> + <type>jar</type> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>woodstox</groupId> + <artifactId>wstx-api</artifactId> + <version>3.2.0</version> + <type>jar</type> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.opennlp</groupId> + <artifactId>opennlp-tools</artifactId> + <version>1.5.1-incubating</version> + </dependency> + <dependency> + <groupId>org.apache.opennlp</groupId> + <artifactId>opennlp-maxent</artifactId> + <version>3.0.1-incubating</version> + </dependency> + <dependency> + <groupId>com.aliasi</groupId> + <artifactId>lingpipe</artifactId> + <version>4.0.1</version> + </dependency> + <dependency> + <groupId>org.annolab.tt4j</groupId> + <artifactId>org.annolab.tt4j</artifactId> + <version>1.0.14</version> + </dependency> + <dependency> + <groupId>org.ini4j</groupId> + <artifactId>ini4j</artifactId> + <version>0.5.2</version> + </dependency> + <dependency> + <groupId>net.didion.jwnl</groupId> + <artifactId>jwnl</artifactId> + <version>1.4.1.RC2</version> + </dependency> + <dependency> + <groupId>org.nlp2rdf</groupId> + <artifactId>nif</artifactId> + <version>1.1-SNAPSHOT</version> + </dependency> - <dependency> - <groupId>org.ini4j</groupId> - <artifactId>ini4j</artifactId> - <version>0.5.2</version> - </dependency> - <dependency> - <groupId>net.didion.jwnl</groupId> - <artifactId>jwnl</artifactId> - <version>1.4.1.RC2</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <excludes> - <exclude>org/dllearner/algorithm/tbsl/*</exclude> - <exclude>org/dllearner/algorithm/qtl/*</exclude> - </excludes> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <version>1.2</version> - <executions> - <execution> - <goals> - <goal>exec</goal> - </goals> - </execution> - </executions> - <configuration> - <executable>java</executable> - <arguments> - <argument>-Xms512m</argument> - <argument>-Xmx4000m</argument> - </arguments> - </configuration> - </plugin> - </plugins> - </build> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludes> + <exclude>org/dllearner/algorithm/tbsl/*</exclude> + <exclude>org/dllearner/algorithm/qtl/*</exclude> + </excludes> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2</version> + <executions> + + <execution> + <goals> + <goal>exec</goal> + </goals> + </execution> + </executions> + <configuration> + <executable>java</executable> + <arguments> + <argument>-Xms512m</argument> + <argument>-Xmx4000m</argument> + </arguments> + </configuration> + </plugin> + </plugins> + </build> </project> Added: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/util/NifExamples.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/util/NifExamples.java (rev 0) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/util/NifExamples.java 2011-10-23 13:50:34 UTC (rev 3316) @@ -0,0 +1,42 @@ +package org.dllearner.algorithm.tbsl.util; + +import com.hp.hpl.jena.ontology.OntClass; +import com.hp.hpl.jena.ontology.OntModel; +import com.hp.hpl.jena.util.iterator.ExtendedIterator; +import org.apache.log4j.Logger; +import org.nlp2rdf.ontology.olia.OLiAManager; +import org.nlp2rdf.ontology.olia.OLiAOntology; + +import java.util.Set; + +/** + */ +public class NifExamples { + private static Logger log = Logger.getLogger(NifExamples.class); + + public static void main(String[] args) { + OLiAManager m = new OLiAManager(); + OLiAOntology brown = m.getOLiAOntology("http://purl.org/olia/brown-link.rdf"); + + System.out.println(brown); + String posTag = "BED"; + String oliaIndividual = null; + if ((oliaIndividual = brown.getIndividualURIForTag(posTag)) != null) { + log.info("The OLia Annotation individual can be null, if the ontology has a gap"); + log.info(oliaIndividual + ""); + } + //adding pos classes from olia and olia-top + Set<String> classes = brown.getClassURIsForTag(posTag); + log.info("Classes found for the POS tag " + posTag); + log.info("" + classes); + + for (String classUri : classes) { + log.info("found: " + classUri + " for: " + posTag); + OntModel hierarchy = brown.getHierarchy(classUri); + for (ExtendedIterator<OntClass> it = hierarchy.listClasses(); it.hasNext(); ) { + OntClass oc = it.next(); + log.info("flattended: " + oc); + } + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |