Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pasqLisena committed Sep 3, 2018
1 parent 4bab57b commit cf992cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'org.doremus'
version '0.3'
version '0.4'

apply plugin: 'java'
apply plugin: 'application'
Expand Down
15 changes: 11 additions & 4 deletions src/main/java/org/doremus/string2vocabulary/SKOSVocabulary.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.doremus.string2vocabulary;

import org.apache.jena.rdf.model.*;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.SKOS;
import org.apache.jena.rdf.model.*;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -22,7 +22,7 @@ public SKOSVocabulary(String name, Model model) {

// for each concept
StmtIterator conceptIter =
vocabulary.listStatements(new SimpleSelector(null, RDF.type, SKOS.Concept));
vocabulary.listStatements(new SimpleSelector(null, RDF.type, SKOS.Concept));

if (!conceptIter.hasNext()) {
System.out.println("SKOSVocabulary constructor | Warning: No concepts in the reference rdf at " + name);
Expand All @@ -35,7 +35,11 @@ public SKOSVocabulary(String name, Model model) {
StmtIterator labelIterator = resource.listProperties(SKOS.prefLabel);
//for each label
while (labelIterator.hasNext()) {
String value = norm(labelIterator.nextStatement().getObject().toString());
Literal nx = labelIterator.nextStatement().getLiteral();
String value = norm(nx.getLexicalForm());
String lang = nx.getLanguage();
if (lang != null && !lang.isEmpty()) value += "@" + nx.getLanguage();

// get the list or create a new one
List<Resource> ls = substitutionMap.computeIfAbsent(value, k -> new ArrayList<>());
// add it to the list
Expand All @@ -45,7 +49,10 @@ public SKOSVocabulary(String name, Model model) {
labelIterator = resource.listProperties(SKOS.altLabel);
//for each label
while (labelIterator.hasNext()) {
String value = norm(labelIterator.nextStatement().getObject().toString());
Literal nx = labelIterator.nextStatement().getLiteral();
String value = norm(nx.getLexicalForm());
String lang = nx.getLanguage();
if (lang != null && !lang.isEmpty()) value += "@" + nx.getLanguage();

// get the list or create a new one
List<Resource> ls = substitutionMap.computeIfAbsent(value, k -> new ArrayList<>());
Expand Down

0 comments on commit cf992cf

Please sign in to comment.