Skip to content
Snippets Groups Projects
Commit acd9d4e1 authored by Sebastien's avatar Sebastien
Browse files

Merge branch '1-project-creation' into 'master'

Resolve "Parser UNL"

Closes #1, #4, and #3

See merge request unl/unl2rdf!2
parents 9375f451 1e61cd21
No related branches found
No related tags found
1 merge request!2Resolve "Parser UNL"
Showing
with 4587 additions and 0 deletions
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
# From : https://gist.github.com/edesdan/6bb43343740bcd54ef0f56a384a2f66f
# Folder view configuration files
.DS_Store
Desktop.ini
# Thumbnail cache files
._*
Thumbs.db
# Files that might appear on external disks
.Spotlight-V100
.Trashes
# Mac
.DS_Store
# From : https://github.com/github/gitignore/blob/master/Java.gitignore
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# From : https://github.com/github/gitignore/blob/master/Maven.gitignore
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
<component name="ArtifactManager">
<artifact type="jar" name="unl2rdf:jar">
<output-path>$PROJECT_DIR$/out/artifacts/unl2rdf_jar</output-path>
<root id="archive" name="unl2rdf.jar">
<element id="module-output" name="unl2rdf" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/info/picocli/picocli/4.2.0/picocli-4.2.0.jar" path-in-jar="/" />
</root>
</artifact>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="rdf" />
<module name="unl-parser" />
</profile>
<profile name="Annotation profile for unl2rdf" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<option name="project" value="unl2rdf/unl2rdf-app" />
<processorPath useClasspath="false">
<entry name="$MAVEN_REPOSITORY$/info/picocli/picocli-codegen/4.2.0/picocli-codegen-4.2.0.jar" />
<entry name="$MAVEN_REPOSITORY$/info/picocli/picocli/4.2.0/picocli-4.2.0.jar" />
</processorPath>
<module name="unl2rdf-app" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="11">
<module name="rdf" target="11" />
<module name="unl-parser" target="11" />
<module name="unl2rdf" target="11" />
<module name="unl2rdf-app" target="11" />
</bytecodeTargetLevel>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="unl-parser" options="" />
<module name="unl2rdf" options="-Aproject=unl2rdf/unl2rdf" />
<module name="unl2rdf-app" options="-Aproject=unl2rdf/unl2rdf-app" />
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/rdf/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/rdf/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/unl-parser/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/unl2rdf-app/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/unl2rdf-app/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
<option value="$PROJECT_DIR$/../rdf/pom.xml" />
</list>
</option>
<option name="ignoredFiles">
<set>
<option value="$PROJECT_DIR$/pom.xml" />
</set>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_13" default="false" project-jdk-name="11" project-jdk-type="JavaSDK" />
</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$/rdf/rdf.iml" filepath="$PROJECT_DIR$/rdf/rdf.iml" />
<module fileurl="file://$PROJECT_DIR$/unl-parser/unl-parser.iml" filepath="$PROJECT_DIR$/unl-parser/unl-parser.iml" />
<module fileurl="file://$PROJECT_DIR$/unl2rdf-app/unl2rdf-app.iml" filepath="$PROJECT_DIR$/unl2rdf-app/unl2rdf-app.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$" />
<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" />
</component>
</project>
\ No newline at end of file
pom.xml 0 → 100644
<?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>unl2rdf</groupId>
<artifactId>unl2rdf</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<packaging>pom</packaging>
<modules>
<module>unl-parser</module>
<module>unl2rdf-app</module>
<module>rdf</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>unl2rdf.Unl2Rdf</mainClass>
<classpathPrefix>dependency-jars/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<groups>acceptance | !feature-a</groups>
<excludedGroups>integration, regression</excludedGroups>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
<?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">
<parent>
<artifactId>unl2rdf</artifactId>
<groupId>unl2rdf</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>rdf</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<type>pom</type>
<version>3.14.0</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<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" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-shacl:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-arq:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-core:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-iri:3.14.0" level="project" />
<orderEntry type="library" name="Maven: commons-cli:commons-cli:1.4" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.13" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-base:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-csv:1.7" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.19" level="project" />
<orderEntry type="library" name="Maven: com.github.andrewoma.dexx:collection:0.7" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-shaded-guava:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.10" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.12" level="project" />
<orderEntry type="library" name="Maven: com.github.jsonld-java:jsonld-java:0.12.5" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.10.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.10.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient-cache:4.5.10" level="project" />
<orderEntry type="library" name="Maven: org.apache.thrift:libthrift:0.13.0" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.26" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-tdb:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-tdb2:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-dboe-storage:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-dboe-trans-data:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-dboe-transaction:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-dboe-base:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-dboe-index:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.jena:jena-rdfconnection:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.7.0-M1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.0-M1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.7.0-M1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.7.0-M1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.0-M1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.7.0-M1" level="project" />
</component>
</module>
\ No newline at end of file
public class UnlDocumentToRdfConverter {
}
This diff is collapsed.
This diff is collapsed.
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
class RdfSchemaOfUnlTest {
@Test
void createRdfOfUnlSentence() throws IOException {
var model = ModelFactory.createDefaultModel();
var test = model.createResource();
Resource sentence = model.createResource("R2", VocabularyUnl.UNL_Sentence);
//sentence.addProperty(VocabularyUnl., "The system allows a radio channel to take on two states: Listening and Traffic");
//sentence.addProperty(VocabularyUnl.)
Writer writer = new StringWriter();
model.write(writer, "N-TRIPLES");
Assertions.assertFalse(writer.toString().isBlank());
writer.close();
}
void createUnlDocument(){
var unlDocument = VocabularyUnl.UNL_Sentence;
//unlDocument.addLabel();
}
}
\ No newline at end of file
<?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>unl2rdf</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>unl2rdf</artifactId>
</parent>
<artifactId>unl-parser</artifactId>
<packaging>jar</packaging>
<name>Unl-parser</name>
</project>
package unl;
import java.util.Vector;
class EqualsBuilder {
private final Vector<Object> elements;
public EqualsBuilder() {
this.elements = new Vector<>();
}
@Override
public boolean equals(Object obj) {
if(null == obj) return false;
if(!(obj instanceof EqualsBuilder)) return false;
return this.isEqual((EqualsBuilder) obj);
}
public boolean isEqual(EqualsBuilder other) {
return elements.equals(other.elements);
}
@Override
public int hashCode() {
return new HashCodeBuilder()
.append(elements)
.toHashCode();
}
public <TType> EqualsBuilder append(TType v) {
this.elements.add(v);
return this;
}
}
package unl;
import java.util.Collection;
import java.util.Vector;
public class Graph {
private final Vector<GraphNode> nodes;
private final Vector<GraphRelation> relations;
private int nodeCounter;
public Graph(){
this(new Vector<>(), new Vector<>());
}
public Graph(Collection<GraphNode> nodes, Collection<GraphRelation> relations) {
this(new Vector<>(nodes), new Vector<>(relations));
}
private Graph(Vector<GraphNode> nodes, Vector<GraphRelation> relations) {
this.nodes = nodes;
this.relations = relations;
this.nodeCounter = 0;
}
public static GraphNode getEntryNode(GraphRelation relation, String graphNumber) {
String str = relation.getSubGraphReferenceLabel();
GraphNode graphNode = null;
if(str.equals(graphNumber)) {
if (relation.getNode1().isEntryNode()) graphNode = relation.getNode1();
if (relation.getNode2().isEntryNode()) graphNode = relation.getNode2();
}
return graphNode;
}
public static GraphNode getEntryNode(GraphRelation relation){
return getEntryNode(relation, "");
}
public Vector<GraphNode> getNodes() {
return nodes;
}
public Vector<GraphRelation> getRelations() {
return relations;
}
public void add(GraphRelation relation){
// Update node 1
int i1 = nodes.indexOf(relation.getNode1());
if (-1 == i1){
this.add(relation.getNode1());
relation.getNode1().setNodeNumber(++nodeCounter);
} else {
relation.setNode1(nodes.get(i1));
}
// update node 2
int i2 = nodes.indexOf(relation.getNode2());
if (-1 == i2){
this.add(relation.getNode2());
relation.getNode2().setNodeNumber(++nodeCounter);
} else {
relation.setNode2(nodes.get(i2));
}
relations.add(relation);
}
public void add(GraphNode node){
this.nodes.add(node);
}
public GraphNode getEntryNode() throws NoEntryNodeException {
return getEntryNode("");
}
public GraphNode getEntryNode(String graphNumber) throws NoEntryNodeException {
int i = 0;
GraphNode graphNode = null;
while((i < relations.size()) && (null == graphNode)){
graphNode = getEntryNode(this.relations.get(i), graphNumber);
i++;
}
// we may not have found it, because the entry node is isolated (no relation...)
if ((null == graphNode) && (1 == this.nodes.size()) && (this.nodes.get(0).isEntryNode())){
graphNode = this.nodes.get(0);
}
if (null == graphNode) {
throw new NoEntryNodeException("No Entry node for subgraph " + graphNumber);
}
return graphNode;
}
@Override
public java.lang.String toString() {
return InternalToString();
}
protected String InternalToString(){
StringBuilder sb = new StringBuilder();
if(this.relations.isEmpty() && !this.nodes.isEmpty()){
sb.append("[W]")
.append(this.convertNodesToString())
.append("[/W]");
} else {
sb.append(this.convertRelationsToString());
}
return sb.toString();
}
private String convertRelationsToString() {
StringBuilder strBuilder = new StringBuilder();
for (GraphRelation graphRelation : this.relations) {
strBuilder.append(graphRelation.toString())
.append("\n");
}
return strBuilder.toString();
}
private java.lang.String convertNodesToString() {
StringBuilder strBuilder = new StringBuilder();
for (GraphNode graphNode :
this.nodes) {
strBuilder.append(graphNode.toString())
.append("\n");
}
return strBuilder.toString();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment