You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rh...@apache.org on 2017/03/04 19:07:05 UTC
svn commit: r1785512 -
/stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/impl/Resource2ValueAdapter.java
Author: rharo
Date: Sat Mar 4 19:07:05 2017
New Revision: 1785512
URL: http://svn.apache.org/viewvc?rev=1785512&view=rev
Log:
STANBOL-1458: Index rdf:langString literals as RdfText values
Modified:
stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/impl/Resource2ValueAdapter.java
Modified: stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/impl/Resource2ValueAdapter.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/impl/Resource2ValueAdapter.java?rev=1785512&r1=1785511&r2=1785512&view=diff
==============================================================================
--- stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/impl/Resource2ValueAdapter.java (original)
+++ stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/impl/Resource2ValueAdapter.java Sat Mar 4 19:07:05 2017
@@ -20,14 +20,19 @@ import org.apache.clerezza.commons.rdf.L
import org.apache.clerezza.commons.rdf.RDFTerm;
import org.apache.clerezza.commons.rdf.IRI;
import org.apache.clerezza.rdf.core.LiteralFactory;
+import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
import org.apache.stanbol.entityhub.servicesapi.util.AdaptingIterator.Adapter;
import org.apache.stanbol.entityhub.model.clerezza.RdfResourceUtils;
import org.apache.stanbol.entityhub.model.clerezza.RdfValueFactory;
import org.apache.stanbol.entityhub.model.clerezza.RdfResourceUtils.XsdDataTypeEnum;
import org.apache.stanbol.entityhub.servicesapi.model.Representation;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.lang.model.element.Name;
+
+
/**
* Converts the Resources (used to store field values in the Clerezza triple store) back to values as defined
* by the {@link Representation} interface
@@ -53,9 +58,18 @@ public class Resource2ValueAdapter<T ext
Literal literal = (Literal) value;
if (literal.getDataType() == null) { // if no dataType is defined
// return a Text without a language
- return valueFactory.createText(literal);
+ if (literal.getLanguage() != null){
+ return valueFactory.createText(literal.getLexicalForm(), literal.getLanguage().toString());
+ } else {
+ return valueFactory.createText(literal);
+ }
} else {
XsdDataTypeEnum mapping = RdfResourceUtils.XSD_DATATYPE_VALUE_MAPPING.get(literal.getDataType());
+ if (mapping == null &&
+ literal.getDataType().getUnicodeString().equals(NamespaceEnum.rdf+"langString") &&
+ literal.getLanguage() != null){
+ return valueFactory.createText(literal.getLexicalForm(), literal.getLanguage().toString());
+ }
if (mapping != null) {
if (mapping.getMappedClass() != null) {
try {