Repository: incubator-rya
Updated Branches:
  refs/heads/master 2c1efd225 -> 2396ebb87


http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2396ebb8/extras/rya.geoindexing/geo.mongo/src/test/java/org/apache/rya/indexing/geotemporal/mongo/GeoTemporalMongoDBStorageStrategyTest.java
----------------------------------------------------------------------
diff --git 
a/extras/rya.geoindexing/geo.mongo/src/test/java/org/apache/rya/indexing/geotemporal/mongo/GeoTemporalMongoDBStorageStrategyTest.java
 
b/extras/rya.geoindexing/geo.mongo/src/test/java/org/apache/rya/indexing/geotemporal/mongo/GeoTemporalMongoDBStorageStrategyTest.java
index b50fddb..55f3fa1 100644
--- 
a/extras/rya.geoindexing/geo.mongo/src/test/java/org/apache/rya/indexing/geotemporal/mongo/GeoTemporalMongoDBStorageStrategyTest.java
+++ 
b/extras/rya.geoindexing/geo.mongo/src/test/java/org/apache/rya/indexing/geotemporal/mongo/GeoTemporalMongoDBStorageStrategyTest.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.rya.api.domain.RyaStatement;
 import org.apache.rya.api.resolver.RdfToRyaConversions;
 import org.apache.rya.indexing.GeoConstants;
 import org.apache.rya.indexing.IndexingExpr;
@@ -428,10 +429,12 @@ public class GeoTemporalMongoDBStorageStrategyTest {
         Value object = VF.createLiteral("Point(-77.03524 38.889468)", 
GeoConstants.XMLSCHEMA_OGC_WKT);
 
         Statement statement = VF.createStatement(subject, predicate, object, 
context);
-        DBObject actual = 
adapter.serialize(RdfToRyaConversions.convertStatement(statement));
+        RyaStatement ryaStatement = 
RdfToRyaConversions.convertStatement(statement);
+        int expectedId = ryaStatement.getSubject().hashCode();
+        DBObject actual = adapter.serialize(ryaStatement);
         String expectedString =
             "{ "
-            + "\"_id\" : -852305321 , "
+            + "\"_id\" : " + expectedId + ", "
             + "\"location\" : { "
               + "\"coordinates\" : [ -77.03524 , 38.889468] , "
               + "\"type\" : \"Point\""
@@ -444,10 +447,12 @@ public class GeoTemporalMongoDBStorageStrategyTest {
         predicate = VF.createIRI("Property:event:time");
         object = VF.createLiteral("2015-12-30T12:00:00Z");
         statement = VF.createStatement(subject, predicate, object, context);
-        actual = 
adapter.serialize(RdfToRyaConversions.convertStatement(statement));
+        ryaStatement = RdfToRyaConversions.convertStatement(statement);
+        expectedId = ryaStatement.getSubject().hashCode();
+        actual = adapter.serialize(ryaStatement);
         expectedString =
                 "{"
-                  +"_id : -852305321, "
+                  +"_id : " + expectedId + ", "
                   +"time: {"
                     + "instant : {"
                       +"\"$date\" : \"2015-12-30T12:00:00.000Z\""
@@ -461,10 +466,12 @@ public class GeoTemporalMongoDBStorageStrategyTest {
         predicate = VF.createIRI("Property:circa");
         object = 
VF.createLiteral("[1969-12-31T19:00:00-05:00,1969-12-31T19:00:01-05:00]");
         statement = VF.createStatement(subject, predicate, object, context);
-        actual = 
adapter.serialize(RdfToRyaConversions.convertStatement(statement));
+        ryaStatement = RdfToRyaConversions.convertStatement(statement);
+        expectedId = ryaStatement.getSubject().hashCode();
+        actual = adapter.serialize(ryaStatement);
         expectedString =
                 "{"
-                +"_id : -852305321, "
+                +"_id : " + expectedId + ", "
                 +"time: {"
                   + "start : {"
                     +"\"$date\" : \"1970-01-01T00:00:00.000Z\""

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2396ebb8/extras/rya.reasoning/src/main/java/org/apache/rya/reasoning/Fact.java
----------------------------------------------------------------------
diff --git 
a/extras/rya.reasoning/src/main/java/org/apache/rya/reasoning/Fact.java 
b/extras/rya.reasoning/src/main/java/org/apache/rya/reasoning/Fact.java
index ad0ba14..2873761 100644
--- a/extras/rya.reasoning/src/main/java/org/apache/rya/reasoning/Fact.java
+++ b/extras/rya.reasoning/src/main/java/org/apache/rya/reasoning/Fact.java
@@ -27,6 +27,7 @@ import java.nio.charset.StandardCharsets;
 import org.apache.hadoop.io.WritableComparable;
 import org.apache.rya.api.domain.RyaStatement;
 import org.apache.rya.api.resolver.RyaToRdfConversions;
+import org.apache.rya.api.utils.LiteralLanguageUtils;
 import org.eclipse.rdf4j.model.IRI;
 import org.eclipse.rdf4j.model.Literal;
 import org.eclipse.rdf4j.model.Resource;
@@ -63,14 +64,14 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
     /**
      * A fact containing a triple and no generating rule.
      */
-    public Fact(Statement stmt) {
+    public Fact(final Statement stmt) {
         this.triple = stmt;
     }
 
     /**
      * A fact containing a triple and no generating rule.
      */
-    public Fact(Resource s, IRI p, Value o) {
+    public Fact(final Resource s, final IRI p, final Value o) {
         this.triple = VF.createStatement(s, p, o);
     }
 
@@ -78,8 +79,8 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
      * A fact which contains a triple and was generated using a
      * particular rule by a reasoner for a particular node.
      */
-    public Fact(Resource s, IRI p, Value o, int iteration,
-            OwlRule rule, Resource node) {
+    public Fact(final Resource s, final IRI p, final Value o, final int 
iteration,
+            final OwlRule rule, final Resource node) {
         this.triple = VF.createStatement(s, p, o);
         this.derivation = new Derivation(iteration, rule, node);
     }
@@ -142,14 +143,14 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
     /**
      * Assign a particular statement to this fact.
      */
-    public void setTriple(Statement stmt) {
+    public void setTriple(final Statement stmt) {
         triple = stmt;
     }
 
     /**
      * Assign a particular statement to this fact.
      */
-    public void setTriple(RyaStatement rs) {
+    public void setTriple(final RyaStatement rs) {
         setTriple(RyaToRdfConversions.convertStatement(rs));
     }
 
@@ -157,14 +158,14 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
      * Set a flag if this triple *could* be used in future derivations
      * (may only actually happen if certain other facts are seen as well.)
      */
-    public void setUseful(boolean useful) {
+    public void setUseful(final boolean useful) {
         this.useful = useful;
     }
 
     /**
      * Set derivation. Allows reconstructing a fact and the way it was 
produced.
      */
-    public void setDerivation(Derivation d) {
+    public void setDerivation(final Derivation d) {
         this.derivation = d;
     }
 
@@ -173,7 +174,7 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
      * of the fact from the way it was produced.
      */
     public Derivation unsetDerivation() {
-        Derivation d = getDerivation();
+        final Derivation d = getDerivation();
         this.derivation = null;
         return d;
     }
@@ -183,7 +184,7 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
      * @param   multiline    Print a multi-line tree as opposed to a nested 
list
      * @param   schema       Use schema knowledge to further explain BNodes
      */
-    public String explain(boolean multiline, Schema schema) {
+    public String explain(final boolean multiline, final Schema schema) {
         return explain(multiline, "", schema);
     }
 
@@ -192,15 +193,15 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
      * schema information.
      * @param   multiline    Print a multi-line tree as opposed to a nested 
list
      */
-    public String explain(boolean multiline) {
+    public String explain(final boolean multiline) {
         return explain(multiline, "", null);
     }
 
     /**
      * Recursively generate a String to show this fact's derivation.
      */
-    String explain(boolean multiline, String prefix, Schema schema) {
-        StringBuilder sb = new StringBuilder();
+    String explain(final boolean multiline, final String prefix, final Schema 
schema) {
+        final StringBuilder sb = new StringBuilder();
         String sep = " ";
         if (multiline) {
             sep = "\n" + prefix;
@@ -209,15 +210,15 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
             sb.append("(empty)").append(sep);
         }
         else {
-            Resource s = getSubject();
-            IRI p = getPredicate();
-            Value o = getObject();
+            final Resource s = getSubject();
+            final IRI p = getPredicate();
+            final Value o = getObject();
             sb.append("<").append(s.toString()).append(">").append(sep);
             sb.append("<").append(p.toString()).append(">").append(sep);
             sb.append("<").append(o.toString()).append(">");
             // Restrictions warrant further explanation
             if (schema != null && p.equals(RDF.TYPE)) {
-                Resource objClass = (Resource) o;
+                final Resource objClass = (Resource) o;
                 if (schema.hasRestriction(objClass)) {
                     sb.append(" { ");
                     sb.append(schema.explainRestriction(objClass));
@@ -240,7 +241,7 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
      */
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder();
+        final StringBuilder sb = new StringBuilder();
         if (triple != null) {
             sb.append("<").append(getSubject().toString()).append("> ");
             sb.append("<").append(getPredicate().toString()).append("> ");
@@ -255,25 +256,25 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
     }
 
     @Override
-    public void write(DataOutput out) throws IOException {
+    public void write(final DataOutput out) throws IOException {
         if (triple == null) {
             out.writeInt(0);
         }
         else {
-            StringBuilder sb = new StringBuilder();
+            final StringBuilder sb = new StringBuilder();
             if (triple.getContext() != null) {
                 sb.append(triple.getContext().toString());
             }
             sb.append(SEP).append(getSubject().toString());
             sb.append(SEP).append(getPredicate().toString());
             sb.append(SEP).append(getObject().toString());
-            byte[] encoded = sb.toString().getBytes(StandardCharsets.UTF_8);
+            final byte[] encoded = 
sb.toString().getBytes(StandardCharsets.UTF_8);
             out.writeInt(encoded.length);
             out.write(encoded);
         }
         out.writeBoolean(useful);
         // Write the derivation if there is one
-        boolean derived = isInference();
+        final boolean derived = isInference();
         out.writeBoolean(derived);
         if (derived) {
             derivation.write(out);
@@ -281,21 +282,21 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
     }
 
     @Override
-    public void readFields(DataInput in) throws IOException {
+    public void readFields(final DataInput in) throws IOException {
         derivation = null;
-        int tripleLength = in.readInt();
+        final int tripleLength = in.readInt();
         if (tripleLength == 0) {
             triple = null;
         }
         else {
-            byte[] tripleBytes = new byte[tripleLength];
+            final byte[] tripleBytes = new byte[tripleLength];
             in.readFully(tripleBytes);
-            String tripleString = new String(tripleBytes, 
StandardCharsets.UTF_8);
-            String[] parts = tripleString.split(SEP);
-            ValueFactory factory = SimpleValueFactory.getInstance();
-            String context = parts[0];
+            final String tripleString = new String(tripleBytes, 
StandardCharsets.UTF_8);
+            final String[] parts = tripleString.split(SEP);
+            final ValueFactory factory = SimpleValueFactory.getInstance();
+            final String context = parts[0];
             Resource s = null;
-            IRI p = factory.createIRI(parts[2]);
+            final IRI p = factory.createIRI(parts[2]);
             Value o = null;
             // Subject: either bnode or URI
             if (parts[1].startsWith("_")) {
@@ -310,17 +311,17 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
             }
             else if (parts[3].startsWith("\"")) {
                 //literal: may have language or datatype
-                int close = parts[3].lastIndexOf("\"");
-                int length = parts[3].length();
-                String label = parts[3].substring(1, close);
+                final int close = parts[3].lastIndexOf("\"");
+                final int length = parts[3].length();
+                final String label = parts[3].substring(1, close);
                 if (close == length - 1) {
                     // Just a string enclosed in quotes
                     o = factory.createLiteral(label);
                 }
                 else {
-                    String data = parts[3].substring(close + 1);
-                    if (data.startsWith("@")) {
-                        String lang = data.substring(1);
+                    final String data = parts[3].substring(close + 1);
+                    if 
(data.startsWith(LiteralLanguageUtils.LANGUAGE_DELIMITER)) {
+                        final String lang = data.substring(1);
                         o = factory.createLiteral(label, lang);
                     }
                     else if (data.startsWith("^^<")) {
@@ -354,7 +355,7 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
      * (represent no triple), compare their derivations instead.
      */
     @Override
-    public int compareTo(Fact other) {
+    public int compareTo(final Fact other) {
         if (this.equals(other)) {
             return 0;
         }
@@ -395,14 +396,14 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
      * compare their derivations.
      */
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) {
             return true;
         }
         if (o == null || this.getClass() != o.getClass()) {
             return false;
         }
-        Fact other = (Fact) o;
+        final Fact other = (Fact) o;
         if (this.triple == null) {
             if (other.triple == null) {
                 // Derivations only matter if both facts are empty
@@ -433,7 +434,7 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
 
     @Override
     public Fact clone() {
-        Fact other = new Fact();
+        final Fact other = new Fact();
         other.triple = this.triple;
         other.useful = this.useful;
         if (this.derivation != null) {
@@ -446,7 +447,7 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
      * Specify a source. Wrapper for Derivation.addSource. Instantiates a
      * derivation if none exists.
      */
-    public void addSource(Fact other) {
+    public void addSource(final Fact other) {
         if (derivation == null) {
             derivation = new Derivation();
         }
@@ -477,14 +478,14 @@ public class Fact implements WritableComparable<Fact>, 
Cloneable {
      * Return whether a particular fact is identical to one used to derive 
this.
      * Wrapper for Derivation.hasSource.
      */
-    public boolean hasSource(Fact other) {
+    public boolean hasSource(final Fact other) {
         return derivation != null && derivation.hasSource(other);
     }
 
     /**
      * Return whether this fact was derived using a particular rule.
      */
-    public boolean hasRule(OwlRule rule) {
+    public boolean hasRule(final OwlRule rule) {
         return derivation != null && derivation.getRule() == rule;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2396ebb8/mapreduce/src/main/java/org/apache/rya/accumulo/mr/RyaTypeWritable.java
----------------------------------------------------------------------
diff --git 
a/mapreduce/src/main/java/org/apache/rya/accumulo/mr/RyaTypeWritable.java 
b/mapreduce/src/main/java/org/apache/rya/accumulo/mr/RyaTypeWritable.java
index be90180..3050b61 100644
--- a/mapreduce/src/main/java/org/apache/rya/accumulo/mr/RyaTypeWritable.java
+++ b/mapreduce/src/main/java/org/apache/rya/accumulo/mr/RyaTypeWritable.java
@@ -25,6 +25,7 @@ import java.io.IOException;
 
 import org.apache.hadoop.io.WritableComparable;
 import org.apache.rya.api.domain.RyaType;
+import org.apache.rya.api.utils.LiteralLanguageUtils;
 import org.eclipse.rdf4j.model.IRI;
 import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
 
@@ -38,10 +39,10 @@ public class RyaTypeWritable implements 
WritableComparable<RyaTypeWritable>{
      * @return The next individual field, as a byte array.
      * @throws IOException if reading from the stream fails.
      */
-    protected byte[] read(DataInput dataInput) throws IOException {
+    protected byte[] read(final DataInput dataInput) throws IOException {
         if (dataInput.readBoolean()) {
-            int len = dataInput.readInt();
-            byte[] bytes = new byte[len];
+            final int len = dataInput.readInt();
+            final byte[] bytes = new byte[len];
             dataInput.readFully(bytes);
             return bytes;
         }else {
@@ -50,19 +51,24 @@ public class RyaTypeWritable implements 
WritableComparable<RyaTypeWritable>{
     }
 
     @Override
-    public void readFields(DataInput dataInput) throws IOException {
-        SimpleValueFactory vfi = SimpleValueFactory.getInstance();
-        String data = dataInput.readLine();
-        String dataTypeString = dataInput.readLine();
-        IRI dataType = vfi.createIRI(dataTypeString);
+    public void readFields(final DataInput dataInput) throws IOException {
+        final SimpleValueFactory vfi = SimpleValueFactory.getInstance();
+        final String data = dataInput.readLine();
+        final String dataTypeString = dataInput.readLine();
+        final String language = dataInput.readLine();
+        final IRI dataType = vfi.createIRI(dataTypeString);
+        final String validatedLanguage = 
LiteralLanguageUtils.validateLanguage(language, dataType);
         ryatype.setData(data);
         ryatype.setDataType(dataType);
+        ryatype.setLanguage(validatedLanguage);
+
     }
 
     @Override
-    public void write(DataOutput dataOutput) throws IOException {
+    public void write(final DataOutput dataOutput) throws IOException {
         dataOutput.writeChars(ryatype.getData());
         dataOutput.writeChars(ryatype.getDataType().toString());
+        dataOutput.writeChars(ryatype.getLanguage());
     }
 
     /**
@@ -77,12 +83,12 @@ public class RyaTypeWritable implements 
WritableComparable<RyaTypeWritable>{
      * @param   ryaStatement    The statement to be represented by this
      *                          RyaStatementWritable.
      */
-    public void setRyaType(RyaType ryatype) {
+    public void setRyaType(final RyaType ryatype) {
         this.ryatype = ryatype;
     }
 
     @Override
-    public int compareTo(RyaTypeWritable o) {
+    public int compareTo(final RyaTypeWritable o) {
         return ryatype.compareTo(o.ryatype);
     }
 
@@ -93,15 +99,15 @@ public class RyaTypeWritable implements 
WritableComparable<RyaTypeWritable>{
      *          RyaTypes.
      */
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (o == this) {
             return true;
         }
         if (o == null || !(o instanceof RyaTypeWritable)) {
             return false;
         }
-        RyaType rtThis = ryatype;
-        RyaType rtOther = ((RyaTypeWritable) o).ryatype;
+        final RyaType rtThis = ryatype;
+        final RyaType rtOther = ((RyaTypeWritable) o).ryatype;
         if (rtThis == null) {
             return rtOther == null;
         }

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2396ebb8/mapreduce/src/test/java/org/apache/rya/accumulo/mr/GraphXInputFormatTest.java
----------------------------------------------------------------------
diff --git 
a/mapreduce/src/test/java/org/apache/rya/accumulo/mr/GraphXInputFormatTest.java 
b/mapreduce/src/test/java/org/apache/rya/accumulo/mr/GraphXInputFormatTest.java
index 93df522..9012cac 100644
--- 
a/mapreduce/src/test/java/org/apache/rya/accumulo/mr/GraphXInputFormatTest.java
+++ 
b/mapreduce/src/test/java/org/apache/rya/accumulo/mr/GraphXInputFormatTest.java
@@ -20,13 +20,6 @@ package org.apache.rya.accumulo.mr;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.rya.accumulo.AccumuloRdfConfiguration;
-import org.apache.rya.accumulo.AccumuloRyaDAO;
-import org.apache.rya.accumulo.mr.GraphXInputFormat.RyaStatementRecordReader;
-import org.apache.rya.api.domain.RyaStatement;
-import org.apache.rya.api.domain.RyaType;
-import org.apache.rya.api.domain.RyaIRI;
-
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.mock.MockInstance;
@@ -40,6 +33,13 @@ import org.apache.hadoop.mapreduce.TaskAttemptID;
 import org.apache.hadoop.mapreduce.TaskID;
 import org.apache.hadoop.mapreduce.task.JobContextImpl;
 import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl;
+import org.apache.rya.accumulo.AccumuloRdfConfiguration;
+import org.apache.rya.accumulo.AccumuloRyaDAO;
+import org.apache.rya.accumulo.mr.GraphXInputFormat.RyaStatementRecordReader;
+import org.apache.rya.api.domain.RyaIRI;
+import org.apache.rya.api.domain.RyaStatement;
+import org.apache.rya.api.domain.RyaType;
+import org.apache.rya.api.utils.LiteralLanguageUtils;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -47,8 +47,8 @@ import org.junit.Test;
 
 public class GraphXInputFormatTest {
 
-    private String username = "root", table = "rya_eci";
-    private PasswordToken password = new PasswordToken("");
+    private final String username = "root", table = "rya_eci";
+    private final PasswordToken password = new PasswordToken("");
 
     private Instance instance;
     private AccumuloRyaDAO apiImpl;
@@ -56,10 +56,10 @@ public class GraphXInputFormatTest {
     @Before
     public void init() throws Exception {
         instance = new MockInstance(GraphXInputFormatTest.class.getName() + 
".mock_instance");
-        Connector connector = instance.getConnector(username, password);
+        final Connector connector = instance.getConnector(username, password);
         connector.tableOperations().create(table);
 
-        AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
+        final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
         conf.setTablePrefix("rya_");
         conf.setDisplayQueryPlan(false);
         conf.setBoolean("sc.use_entity", true);
@@ -77,7 +77,7 @@ public class GraphXInputFormatTest {
 
     @Test
     public void testInputFormat() throws Exception {
-        RyaStatement input = RyaStatement.builder()
+        final RyaStatement input = RyaStatement.builder()
             .setSubject(new RyaIRI("http://www.google.com";))
             .setPredicate(new RyaIRI("http://some_other_uri";))
             .setObject(new RyaIRI("http://www.yahoo.com";))
@@ -87,7 +87,7 @@ public class GraphXInputFormatTest {
 
         apiImpl.add(input);
 
-        Job jobConf = Job.getInstance();
+        final Job jobConf = Job.getInstance();
 
         GraphXInputFormat.setMockInstance(jobConf, instance.getInstanceName());
         GraphXInputFormat.setConnectorInfo(jobConf, username, password);
@@ -98,31 +98,33 @@ public class GraphXInputFormatTest {
         GraphXInputFormat.setLocalIterators(jobConf, false);
         GraphXInputFormat.setOfflineTableScan(jobConf, false);
 
-        GraphXInputFormat inputFormat = new GraphXInputFormat();
+        final GraphXInputFormat inputFormat = new GraphXInputFormat();
 
-        JobContext context = new JobContextImpl(jobConf.getConfiguration(), 
jobConf.getJobID());
+        final JobContext context = new 
JobContextImpl(jobConf.getConfiguration(), jobConf.getJobID());
 
-        List<InputSplit> splits = inputFormat.getSplits(context);
+        final List<InputSplit> splits = inputFormat.getSplits(context);
 
         Assert.assertEquals(1, splits.size());
 
-        TaskAttemptContext taskAttemptContext = new 
TaskAttemptContextImpl(context.getConfiguration(), new TaskAttemptID(new 
TaskID(), 1));
+        final TaskAttemptContext taskAttemptContext = new 
TaskAttemptContextImpl(context.getConfiguration(), new TaskAttemptID(new 
TaskID(), 1));
 
-        RecordReader<Object, RyaTypeWritable> reader = 
inputFormat.createRecordReader(splits.get(0), taskAttemptContext);
+        final RecordReader<Object, RyaTypeWritable> reader = 
inputFormat.createRecordReader(splits.get(0), taskAttemptContext);
 
-        RyaStatementRecordReader ryaStatementRecordReader = 
(RyaStatementRecordReader)reader;
+        final RyaStatementRecordReader ryaStatementRecordReader = 
(RyaStatementRecordReader)reader;
         ryaStatementRecordReader.initialize(splits.get(0), taskAttemptContext);
 
-        List<RyaType> results = new ArrayList<RyaType>();
+        final List<RyaType> results = new ArrayList<RyaType>();
         System.out.println("before while");
         while(ryaStatementRecordReader.nextKeyValue()) {
             System.out.println("in while");
-            RyaTypeWritable writable = 
ryaStatementRecordReader.getCurrentValue();
-            RyaType value = writable.getRyaType();
-            Object text = ryaStatementRecordReader.getCurrentKey();
-            RyaType type = new RyaType();
+            final RyaTypeWritable writable = 
ryaStatementRecordReader.getCurrentValue();
+            final RyaType value = writable.getRyaType();
+            final Object text = ryaStatementRecordReader.getCurrentKey();
+            final RyaType type = new RyaType();
+            final String validatedLanguage = 
LiteralLanguageUtils.validateLanguage(value.getLanguage(), value.getDataType());
             type.setData(value.getData());
             type.setDataType(value.getDataType());
+            type.setLanguage(validatedLanguage);
             results.add(type);
 
             System.out.println(value.getData());

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2396ebb8/pig/accumulo.pig/src/test/java/org/apache/rya/accumulo/pig/StatementPatternStorageTest.java
----------------------------------------------------------------------
diff --git 
a/pig/accumulo.pig/src/test/java/org/apache/rya/accumulo/pig/StatementPatternStorageTest.java
 
b/pig/accumulo.pig/src/test/java/org/apache/rya/accumulo/pig/StatementPatternStorageTest.java
index 942510b..2b1c652 100644
--- 
a/pig/accumulo.pig/src/test/java/org/apache/rya/accumulo/pig/StatementPatternStorageTest.java
+++ 
b/pig/accumulo.pig/src/test/java/org/apache/rya/accumulo/pig/StatementPatternStorageTest.java
@@ -8,9 +8,9 @@ package org.apache.rya.accumulo.pig;
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,13 +20,14 @@ package org.apache.rya.accumulo.pig;
  */
 
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.admin.SecurityOperations;
 import org.apache.accumulo.core.client.mock.MockInstance;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.hadoop.conf.Configuration;
@@ -36,14 +37,16 @@ import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.RecordReader;
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
 import org.apache.hadoop.mapreduce.TaskAttemptID;
+import org.apache.hadoop.mapreduce.TaskType;
 import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl;
 import org.apache.pig.data.Tuple;
 import org.apache.rya.accumulo.AccumuloRdfConfiguration;
 import org.apache.rya.accumulo.AccumuloRyaDAO;
 import org.apache.rya.api.RdfCloudTripleStoreConstants;
+import org.apache.rya.api.domain.RyaIRI;
 import org.apache.rya.api.domain.RyaStatement;
 import org.apache.rya.api.domain.RyaType;
-import org.apache.rya.api.domain.RyaIRI;
+import org.eclipse.rdf4j.model.vocabulary.RDF;
 
 import junit.framework.TestCase;
 
@@ -55,26 +58,27 @@ import junit.framework.TestCase;
  */
 public class StatementPatternStorageTest extends TestCase {
 
-    private String user = "user";
-    private String pwd = "pwd";
-    private String instance = "myinstance";
-    private String tablePrefix = "t_";
-    private Authorizations auths = Constants.NO_AUTHS;
+    private final String user = "user";
+    private final String pwd = "pwd";
+    private final String instance = "myinstance";
+    private final String tablePrefix = "t_";
+    private final Authorizations auths = Authorizations.EMPTY;
     private Connector connector;
     private AccumuloRyaDAO ryaDAO;
-    private String namespace = "urn:test#";
+    private final String namespace = "urn:test#";
     private AccumuloRdfConfiguration conf;
 
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        connector = new MockInstance(instance).getConnector(user, 
pwd.getBytes());
+        connector = new MockInstance(instance).getConnector(user, new 
PasswordToken(pwd.getBytes(StandardCharsets.UTF_8)));
         connector.tableOperations().create(tablePrefix + 
RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
         connector.tableOperations().create(tablePrefix + 
RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
         connector.tableOperations().create(tablePrefix + 
RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
         connector.tableOperations().create(tablePrefix + 
RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
-        SecurityOperations secOps = connector.securityOperations();
-        secOps.createUser(user, pwd.getBytes(), auths);
+        final SecurityOperations secOps = connector.securityOperations();
+        secOps.createLocalUser(user, new 
PasswordToken(pwd.getBytes(StandardCharsets.UTF_8)));
+        secOps.changeUserAuthorizations(user, auths);
         secOps.grantTablePermission(user, tablePrefix + 
RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, TablePermission.READ);
         secOps.grantTablePermission(user, tablePrefix + 
RdfCloudTripleStoreConstants.TBL_PO_SUFFIX, TablePermission.READ);
         secOps.grantTablePermission(user, tablePrefix + 
RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX, TablePermission.READ);
@@ -101,73 +105,75 @@ public class StatementPatternStorageTest extends TestCase 
{
         ryaDAO.add(new RyaStatement(new RyaIRI(namespace, "a"),new 
RyaIRI(namespace,"p"), new RyaType("l")));
         ryaDAO.add(new RyaStatement(new RyaIRI(namespace, "b"), new 
RyaIRI(namespace, "p"), new RyaType("l")));
         ryaDAO.add(new RyaStatement(new RyaIRI(namespace, "c"), new 
RyaIRI(namespace, "n"), new RyaType("l")));
-        
+        ryaDAO.add(new RyaStatement(new RyaIRI(namespace, "d"), new 
RyaIRI(namespace, "p"), new RyaType(RDF.LANGSTRING, "l", "en-US")));
+
 
         int count = 0;
-        List<StatementPatternStorage> storages = createStorages("accumulo://" 
+ tablePrefix + "?instance=" + instance + "&user=" + user + "&password=" + pwd 
+ "&predicate=<" + namespace + "p>&mock=true");
-        for (StatementPatternStorage storage : storages) {
+        final List<StatementPatternStorage> storages = 
createStorages("accumulo://" + tablePrefix + "?instance=" + instance + "&user=" 
+ user + "&password=" + pwd + "&predicate=<" + namespace + "p>&mock=true");
+        for (final StatementPatternStorage storage : storages) {
             while (true) {
-                Tuple next = storage.getNext();
+                final Tuple next = storage.getNext();
                 if (next == null) {
                     break;
                 }
                 count++;
             }
         }
-        assertEquals(2, count);
+        assertEquals(3, count);
         ryaDAO.destroy();
     }
 
     public void testContext() throws Exception {
         ryaDAO.add(new RyaStatement(new RyaIRI(namespace, "a"), new 
RyaIRI(namespace, "p"), new RyaType("l1")));
         ryaDAO.add(new RyaStatement(new RyaIRI(namespace, "a"), new 
RyaIRI(namespace, "p"), new RyaType("l2"), new RyaIRI(namespace, "g1")));
-        
+        ryaDAO.add(new RyaStatement(new RyaIRI(namespace, "a"), new 
RyaIRI(namespace, "p"), new RyaType(RDF.LANGSTRING, "l1", "en-US"), new 
RyaIRI(namespace, "g1")));
+
 
         int count = 0;
         List<StatementPatternStorage> storages = createStorages("accumulo://" 
+ tablePrefix + "?instance=" + instance + "&user=" + user + "&password=" + pwd 
+ "&predicate=<" + namespace + "p>&mock=true");
-        for (StatementPatternStorage storage : storages) {
+        for (final StatementPatternStorage storage : storages) {
             while (true) {
-                Tuple next = storage.getNext();
+                final Tuple next = storage.getNext();
                 if (next == null) {
                     break;
                 }
                 count++;
             }
         }
-        assertEquals(2, count);
+        assertEquals(3, count);
 
         count = 0;
         storages = createStorages("accumulo://" + tablePrefix + "?instance=" + 
instance + "&user=" + user + "&password=" + pwd + "&predicate=<" + namespace + 
"p>&context=<"+namespace+"g1>&mock=true");
-        for (StatementPatternStorage storage : storages) {
+        for (final StatementPatternStorage storage : storages) {
             while (true) {
-                Tuple next = storage.getNext();
+                final Tuple next = storage.getNext();
                 if (next == null) {
                     break;
                 }
                 count++;
             }
         }
-        assertEquals(1, count);
+        assertEquals(2, count);
 
         ryaDAO.destroy();
     }
 
-    protected List<StatementPatternStorage> createStorages(String location) 
throws IOException, InterruptedException {
-        List<StatementPatternStorage> storages = new 
ArrayList<StatementPatternStorage>();
+    protected List<StatementPatternStorage> createStorages(final String 
location) throws IOException, InterruptedException {
+        final List<StatementPatternStorage> storages = new 
ArrayList<StatementPatternStorage>();
         StatementPatternStorage storage = new StatementPatternStorage();
-        InputFormat inputFormat = storage.getInputFormat();
-        Job job = new Job(new Configuration());
+        final InputFormat<?, ?> inputFormat = storage.getInputFormat();
+        Job job = Job.getInstance(new Configuration());
         storage.setLocation(location, job);
-        List<InputSplit> splits = inputFormat.getSplits(job);
+        final List<InputSplit> splits = inputFormat.getSplits(job);
         assertNotNull(splits);
 
-        for (InputSplit inputSplit : splits) {
+        for (final InputSplit inputSplit : splits) {
             storage = new StatementPatternStorage();
-            job = new Job(new Configuration());
+            job = Job.getInstance(new Configuration());
             storage.setLocation(location, job);
-            TaskAttemptContext taskAttemptContext = new 
TaskAttemptContextImpl(job.getConfiguration(),
-                    new TaskAttemptID("jtid", 0, false, 0, 0));
-            RecordReader recordReader = 
inputFormat.createRecordReader(inputSplit,
+            final TaskAttemptContext taskAttemptContext = new 
TaskAttemptContextImpl(job.getConfiguration(),
+                    new TaskAttemptID("jtid", 0, TaskType.REDUCE, 0, 0));
+            final RecordReader<?, ?> recordReader = 
inputFormat.createRecordReader(inputSplit,
                     taskAttemptContext);
             recordReader.initialize(inputSplit, taskAttemptContext);
 

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/2396ebb8/sail/src/main/java/org/apache/rya/rdftriplestore/RyaSailRepositoryConnection.java
----------------------------------------------------------------------
diff --git 
a/sail/src/main/java/org/apache/rya/rdftriplestore/RyaSailRepositoryConnection.java
 
b/sail/src/main/java/org/apache/rya/rdftriplestore/RyaSailRepositoryConnection.java
index 145d2d0..8b26ff4 100644
--- 
a/sail/src/main/java/org/apache/rya/rdftriplestore/RyaSailRepositoryConnection.java
+++ 
b/sail/src/main/java/org/apache/rya/rdftriplestore/RyaSailRepositoryConnection.java
@@ -8,9 +8,9 @@ package org.apache.rya.rdftriplestore;
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -30,9 +30,11 @@ import org.eclipse.rdf4j.repository.RepositoryException;
 import org.eclipse.rdf4j.repository.sail.SailRepository;
 import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection;
 import org.eclipse.rdf4j.repository.util.RDFLoader;
+import org.eclipse.rdf4j.rio.ParserConfig;
 import org.eclipse.rdf4j.rio.RDFFormat;
 import org.eclipse.rdf4j.rio.RDFHandlerException;
 import org.eclipse.rdf4j.rio.RDFParseException;
+import org.eclipse.rdf4j.rio.helpers.BasicParserSettings;
 import org.eclipse.rdf4j.sail.SailConnection;
 
 /**
@@ -40,65 +42,60 @@ import org.eclipse.rdf4j.sail.SailConnection;
  */
 public class RyaSailRepositoryConnection extends SailRepositoryConnection {
 
-    protected RyaSailRepositoryConnection(SailRepository repository, 
SailConnection sailConnection) {
+    protected RyaSailRepositoryConnection(final SailRepository repository, 
final SailConnection sailConnection) {
         super(repository, sailConnection);
     }
 
     @Override
-    public void add(InputStream in, String baseURI, RDFFormat dataFormat, 
Resource... contexts) throws IOException, RDFParseException,
+    public ParserConfig getParserConfig() {
+        final ParserConfig parserConfig = super.getParserConfig();
+        parserConfig.set(BasicParserSettings.VERIFY_URI_SYNTAX, false);
+        return parserConfig;
+    }
+
+    @Override
+    public void add(final InputStream in, final String baseURI, final 
RDFFormat dataFormat, final Resource... contexts) throws IOException, 
RDFParseException,
             RepositoryException {
         OpenRDFUtil.verifyContextNotNull(contexts);
 
-        CombineContextsRdfInserter rdfInserter = new 
CombineContextsRdfInserter(this);
+        final CombineContextsRdfInserter rdfInserter = new 
CombineContextsRdfInserter(this);
         rdfInserter.enforceContext(contexts);
 
-        boolean localTransaction = startLocalTransaction();
+        final boolean localTransaction = startLocalTransaction();
         try {
-            RDFLoader loader = new RDFLoader(getParserConfig(), 
getValueFactory());
+            final RDFLoader loader = new RDFLoader(getParserConfig(), 
getValueFactory());
             loader.load(in, baseURI, dataFormat, rdfInserter);
 
             conditionalCommit(localTransaction);
-        } catch (RDFHandlerException e) {
+        } catch (final RDFHandlerException e) {
             conditionalRollback(localTransaction);
 
             throw ((RepositoryException) e.getCause());
-        } catch (RDFParseException e) {
-            conditionalRollback(localTransaction);
-            throw e;
-        } catch (IOException e) {
-            conditionalRollback(localTransaction);
-            throw e;
-        } catch (RuntimeException e) {
+        } catch (final IOException | RuntimeException e) {
             conditionalRollback(localTransaction);
             throw e;
         }
     }
 
     @Override
-    public void add(Reader reader, String baseURI, RDFFormat dataFormat, 
Resource... contexts) throws IOException, RDFParseException,
+    public void add(final Reader reader, final String baseURI, final RDFFormat 
dataFormat, final Resource... contexts) throws IOException, RDFParseException,
             RepositoryException {
         OpenRDFUtil.verifyContextNotNull(contexts);
 
-        CombineContextsRdfInserter rdfInserter = new 
CombineContextsRdfInserter(this);
+        final CombineContextsRdfInserter rdfInserter = new 
CombineContextsRdfInserter(this);
         rdfInserter.enforceContext(contexts);
 
-        boolean localTransaction = startLocalTransaction();
+        final boolean localTransaction = startLocalTransaction();
         try {
-            RDFLoader loader = new RDFLoader(getParserConfig(), 
getValueFactory());
+            final RDFLoader loader = new RDFLoader(getParserConfig(), 
getValueFactory());
             loader.load(reader, baseURI, dataFormat, rdfInserter);
 
             conditionalCommit(localTransaction);
-        } catch (RDFHandlerException e) {
+        } catch (final RDFHandlerException e) {
             conditionalRollback(localTransaction);
 
             throw ((RepositoryException) e.getCause());
-        } catch (RDFParseException e) {
-            conditionalRollback(localTransaction);
-            throw e;
-        } catch (IOException e) {
-            conditionalRollback(localTransaction);
-            throw e;
-        } catch (RuntimeException e) {
+        } catch (final IOException | RuntimeException e) {
             conditionalRollback(localTransaction);
             throw e;
         }


Reply via email to