Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration test #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions nb-configuration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<netbeans.hint.jdkPlatform>JDK_11</netbeans.hint.jdkPlatform>
</properties>
</project-shared-configuration>
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<type>pom</type>
<version>2.11.1</version>
<version>3.11.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
Expand Down Expand Up @@ -193,7 +193,7 @@
<copy file="tbx2rdfConversion.sh" todir="${project.build.directory}/forZip" />
<copy file="tbx2rdfConversion.bat" todir="${project.build.directory}/forZip" />
<copy file="mappings.default" todir="${project.build.directory}/forZip" />
<copy file="readme.txt" todir="${project.build.directory}/forZip" />
<copy file="README.md" todir="${project.build.directory}/forZip" />
<copy file="log4j.properties" todir="${project.build.directory}/forZip" />

<copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
Expand Down
4 changes: 2 additions & 2 deletions src/java/tbx2rdf/Main.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package tbx2rdf;

import tbx2rdf.types.TBX_Terminology;
import com.hp.hpl.jena.rdf.model.Model;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
Expand All @@ -15,6 +14,7 @@
import java.util.regex.Pattern;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.jena.rdf.model.Model;
import org.apache.jena.riot.Lang;
import org.apache.jena.riot.RDFDataMgr;
import org.apache.log4j.Logger;
Expand Down Expand Up @@ -221,7 +221,7 @@ public static boolean convertBigFile() {
System.err.println("output file could not be open");
return false;
}
converter.convertAndSerializeLargeFile(input_file, fos, mappings);
converter.convertAndSerializeLargeFile(input_file, fos, mappings, Main.DATA_NAMESPACE);
} catch (Exception e) {
System.err.println(e.getMessage());
return false;
Expand Down
6 changes: 3 additions & 3 deletions src/java/tbx2rdf/RDF2TBX_Converter.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package tbx2rdf;

//JENA
import com.hp.hpl.jena.query.*;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.RDFNode;
import org.apache.jena.query.*;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.RDFNode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
Expand Down
12 changes: 6 additions & 6 deletions src/java/tbx2rdf/SAXHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.RDF;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.RDF;

import tbx2rdf.datasets.lexvo.LexvoManager;
import tbx2rdf.types.MartifHeader;
Expand Down Expand Up @@ -77,15 +77,15 @@ public Model getLexiconsModel()
/**
* Obtains a map of lexicons present in the
*/
public HashMap<String, Resource> getLexicons()
public HashMap<String, Resource> getLexicons(String namespace)
{
lexiconsModel = ModelFactory.createDefaultModel();
final HashMap<String, Resource> lexicons = new HashMap<>();
for(String language : languages)
{
if (lexicons.containsKey(language))
continue;
final Resource lexicon = lexiconsModel.createResource(Main.DATA_NAMESPACE + language);
final Resource lexicon = lexiconsModel.createResource(namespace + language);
Resource rlan=LexvoManager.mgr.getLexvoFromISO2(language);
//lexicon.addProperty(ONTOLEX.language, rlan); //before it was the mere constant "language" //OLD
lexicon.addProperty(DC.language, rlan); //before it was the mere constant "language"
Expand Down
24 changes: 12 additions & 12 deletions src/java/tbx2rdf/TBX2RDF_Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
import org.xml.sax.SAXException;

//JENA
import org.openjena.riot.Lang;
import org.apache.jena.riot.Lang;
import org.apache.jena.riot.RDFDataMgr;
import org.apache.jena.riot.RDFFormat;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.DCTerms;
import com.hp.hpl.jena.vocabulary.RDF;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.DCTerms;
import org.apache.jena.vocabulary.RDF;

//TBX2RDF
import java.io.PrintStream;
Expand Down Expand Up @@ -293,7 +293,7 @@ private Collection<? extends Term> processBack(Element root, Mappings mappings)
* Processes, from a node, a termEntry
* @return A Term
*/
Term processTermEntry(Element node, Mappings mappings) {
public Term processTermEntry(Element node, Mappings mappings) {
// create new Term
// add subjectField
// add ID
Expand Down Expand Up @@ -916,8 +916,8 @@ private Mapping processType(Element sub, Mappings mappings, boolean required) {
* @param mappings Mappings
* @return The TBX terminology
*/
public TBX_Terminology convertAndSerializeLargeFile(String file, PrintStream fos, Mappings mappings) {
String resourceURI = new String(Main.DATA_NAMESPACE);
public TBX_Terminology convertAndSerializeLargeFile(String file, PrintStream fos, Mappings mappings, String namespace) {
String resourceURI = new String(namespace);
FileInputStream inputStream = null;
Scanner sc = null;
int count = 0;
Expand All @@ -932,7 +932,7 @@ public TBX_Terminology convertAndSerializeLargeFile(String file, PrintStream fos
SAXParser saxParser = factory.newSAXParser();
handler = new SAXHandler(mappings);
saxParser.parse(xmlInput, handler);
lexicons = handler.getLexicons();
lexicons = handler.getLexicons(namespace);
xmlInput.close();
} catch (Exception e) {
logger.warn("There was an error while reading/creting the lexicons, this could affect the rest of the code");
Expand Down Expand Up @@ -1051,7 +1051,7 @@ public TBX_Terminology convertAndSerializeLargeFile(String file, PrintStream fos
* Gently loads a DOM XML document from a XML fragment.
* If it fails, it returns null;
*/
private static Document loadXMLFromString(String xml) throws Exception {
public static Document loadXMLFromString(String xml) throws Exception {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Expand Down
12 changes: 6 additions & 6 deletions src/java/tbx2rdf/TBX2RDF_Tutorial.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.jena.riot.RDFDataMgr;
import org.openjena.riot.Lang;
import org.apache.jena.riot.Lang;
import org.xml.sax.SAXException;
import tbx2rdf.types.TBX_Terminology;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.vocabulary.RDF;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.RDFNode;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.Statement;
import org.apache.jena.vocabulary.RDF;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.util.List;
Expand Down
8 changes: 4 additions & 4 deletions src/java/tbx2rdf/datasets/iate/SubjectField.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package tbx2rdf.datasets.iate;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.RDF;
import com.hp.hpl.jena.vocabulary.RDFS;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;

import tbx2rdf.types.abs.impID;
import tbx2rdf.vocab.TBX;
Expand Down
4 changes: 2 additions & 2 deletions src/java/tbx2rdf/datasets/iate/SubjectFields.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tbx2rdf.datasets.iate;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
Expand Down
6 changes: 3 additions & 3 deletions src/java/tbx2rdf/datasets/lexvo/LexvoManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import java.util.StringTokenizer;

//JENA
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;

/**
* This class provides with methods to obtain the Lexvo resource corresponding to a language iso code.
Expand Down
6 changes: 3 additions & 3 deletions src/java/tbx2rdf/types/AdminGrp.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package tbx2rdf.types;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.RDF;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.RDF;
import java.util.ArrayList;
import java.util.List;
import tbx2rdf.DatatypePropertyMapping;
Expand Down
4 changes: 2 additions & 2 deletions src/java/tbx2rdf/types/Describable.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package tbx2rdf.types;

//JENA
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
//Java
import java.util.ArrayList;
import java.util.List;
Expand Down
6 changes: 3 additions & 3 deletions src/java/tbx2rdf/types/DescripGrp.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package tbx2rdf.types;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.RDF;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.RDF;
import java.util.ArrayList;
import java.util.List;
import tbx2rdf.DatatypePropertyMapping;
Expand Down
6 changes: 3 additions & 3 deletions src/java/tbx2rdf/types/LexicalEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import tbx2rdf.vocab.DC;
import tbx2rdf.vocab.LIME;
import tbx2rdf.vocab.ONTOLEX;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.RDF;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.RDF;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
Expand Down
12 changes: 6 additions & 6 deletions src/java/tbx2rdf/types/MartifHeader.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package tbx2rdf.types;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.NodeIterator;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.DC_11;
import com.hp.hpl.jena.vocabulary.RDF;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.NodeIterator;
import org.apache.jena.rdf.model.RDFNode;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.DC_11;
import org.apache.jena.vocabulary.RDF;
import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Element;
Expand Down
6 changes: 3 additions & 3 deletions src/java/tbx2rdf/types/Note.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package tbx2rdf.types;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.RDFS;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.RDFS;
import org.w3c.dom.NodeList;
import tbx2rdf.Mappings;
import tbx2rdf.types.abs.impIDLang;
Expand Down
4 changes: 2 additions & 2 deletions src/java/tbx2rdf/types/NoteLinkInfo.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tbx2rdf.types;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import java.util.ArrayList;
import java.util.List;
import tbx2rdf.Mappings;
Expand Down
14 changes: 7 additions & 7 deletions src/java/tbx2rdf/types/TBX_Terminology.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package tbx2rdf.types;

import tbx2rdf.vocab.TBX;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.DCTerms;
import com.hp.hpl.jena.vocabulary.DC_11;
import com.hp.hpl.jena.vocabulary.RDF;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.DCTerms;
import org.apache.jena.vocabulary.DC_11;
import org.apache.jena.vocabulary.RDF;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -68,7 +68,7 @@ public Model getModel(String resourceURI) {
term.toRDF(model, concept);
for (LexicalEntry le : term.Lex_entries) {
if (!lexicons.containsKey(le.lang)) {
final Resource lexicon = model.createResource(Main.DATA_NAMESPACE + le.lang);
final Resource lexicon = model.createResource(resourceURI + le.lang);
Resource rlan = LexvoManager.mgr.getLexvoFromISO2(le.lang);
//lexicon.addProperty(ONTOLEX.language, rlan);// OLD
lexicon.addProperty(LIME.language, le.lang);
Expand Down
8 changes: 4 additions & 4 deletions src/java/tbx2rdf/types/Term.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import tbx2rdf.vocab.ONTOLEX;
import tbx2rdf.vocab.TBX;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.vocabulary.RDF;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.Statement;
import org.apache.jena.vocabulary.RDF;

import java.util.HashSet;
import java.util.Set;
Expand Down
8 changes: 4 additions & 4 deletions src/java/tbx2rdf/types/TermComp.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package tbx2rdf.types;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.RDF;
import com.hp.hpl.jena.vocabulary.RDFS;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
import tbx2rdf.Mappings;
import tbx2rdf.types.abs.impIDLang;
import tbx2rdf.vocab.ONTOLEX;
Expand Down
4 changes: 2 additions & 2 deletions src/java/tbx2rdf/types/TermCompGrp.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tbx2rdf.types;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import java.util.ArrayList;
import java.util.List;
import tbx2rdf.Mappings;
Expand Down
4 changes: 2 additions & 2 deletions src/java/tbx2rdf/types/TermCompList.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tbx2rdf.types;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import java.util.ArrayList;
import java.util.List;
import tbx2rdf.Mapping;
Expand Down
Loading