You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@any23.apache.org by le...@apache.org on 2018/01/08 13:14:20 UTC

[4/6] any23 git commit: ANY23-320 Address @Ignore tests in Any23 and ANY23-131 Nested Microdata are not extracted

ANY23-320 Address @Ignore tests in Any23 and ANY23-131 Nested Microdata are not extracted


Project: http://git-wip-us.apache.org/repos/asf/any23/repo
Commit: http://git-wip-us.apache.org/repos/asf/any23/commit/60e93a76
Tree: http://git-wip-us.apache.org/repos/asf/any23/tree/60e93a76
Diff: http://git-wip-us.apache.org/repos/asf/any23/diff/60e93a76

Branch: refs/heads/master
Commit: 60e93a76748e53c413529409fb545e2245013639
Parents: 0613280
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Mon Jan 1 02:58:36 2018 +0000
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Mon Jan 1 02:58:36 2018 +0000

----------------------------------------------------------------------
 .../any23/cli/ExtractorDocumentationTest.java   |    2 -
 .../java/org/apache/any23/cli/RoverTest.java    |    2 -
 .../org/apache/any23/cli/SimpleRoverTest.java   |    2 -
 .../any23/extractor/csv/CSVExtractor.java       |   23 +-
 .../extractor/html/EmbeddedJSONLDExtractor.java |  363 ++--
 .../any23/extractor/html/HTMLMetaExtractor.java |   58 +-
 .../apache/any23/extractor/microdata/Item.java  |   10 +-
 .../extractor/microdata/ItemPropValue.java      |   31 +-
 .../any23/extractor/microdata/ItemScope.java    |   29 +-
 .../extractor/microdata/MicrodataExtractor.java |   35 +-
 .../extractor/microdata/MicrodataParser.java    |  136 +-
 .../any23/extractor/xpath/QuadTemplate.java     |    1 +
 .../any23/extractor/xpath/TemplateObject.java   |   39 +-
 .../any23/extractor/xpath/TemplateSubject.java  |   13 +-
 .../any23/extractor/yaml/ElementsProcessor.java |   24 +-
 .../any23/rdf/Any23ValueFactoryWrapper.java     |   61 +-
 .../java/org/apache/any23/rdf/RDFUtils.java     |   82 +-
 .../XMLValidationReportSerializer.java          |   21 +-
 .../any23/validator/rule/AboutNotURIRule.java   |    1 +
 .../validator/rule/MetaNameMisuseRule.java      |    1 +
 .../org/apache/any23/vocab/RDFSchemaUtils.java  |   24 +-
 .../any23/extractor/csv/CSVExtractorTest.java   |  178 +-
 .../html/AbstractExtractorTestCase.java         | 1592 ++++++++-------
 .../extractor/html/HCardExtractorTest.java      | 1852 +++++++++---------
 .../extractor/html/HListingExtractorTest.java   |    3 -
 .../microdata/MicrodataParserTest.java          |   81 +-
 .../any23/extractor/rdfa/RDFaExtractorTest.java |    2 -
 .../TemplateXPathExtractorRuleImplTest.java     |   24 +-
 .../any23/filter/IgnoreAccidentalRDFaTest.java  |    2 +-
 .../org/apache/any23/writer/JSONWriterTest.java |    4 -
 .../org/apache/any23/servlet/ServletTest.java   |    4 -
 ....2.1-non-normative-example-1-expected.nquads |    8 +-
 .../5.2.1-non-normative-example-1.html          |   48 +-
 ....2.1-non-normative-example-2-expected.nquads |   33 +-
 .../5.2.1-non-normative-example-2.html          |   16 +-
 .../microdata-basic-expected.properties         |    6 +-
 .../resources/microdata/microdata-basic.html    |   15 +-
 .../microdata-itemref-expected.properties       |   20 +-
 .../resources/microdata/microdata-itemref.html  |   46 +-
 .../microdata/microdata-json-serialization.json |    2 +-
 .../microdata/microdata-nested-expected.nquads  |   19 +-
 .../microdata-nested-expected.properties        |    4 +-
 .../resources/microdata/microdata-nested.html   |   33 +-
 .../microdata-richsnippet-expected.nquads       |   27 +-
 44 files changed, 2462 insertions(+), 2515 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/cli/src/test/java/org/apache/any23/cli/ExtractorDocumentationTest.java
----------------------------------------------------------------------
diff --git a/cli/src/test/java/org/apache/any23/cli/ExtractorDocumentationTest.java b/cli/src/test/java/org/apache/any23/cli/ExtractorDocumentationTest.java
index 98616ba..97bf4f2 100644
--- a/cli/src/test/java/org/apache/any23/cli/ExtractorDocumentationTest.java
+++ b/cli/src/test/java/org/apache/any23/cli/ExtractorDocumentationTest.java
@@ -42,13 +42,11 @@ public class ExtractorDocumentationTest extends ToolTestBase {
         runToolCheckExit0("--all");
     }
 
-    //@Ignore("no available example")
     @Test
     public void testExampleInput() throws Exception {
         runToolCheckExit0("-i", TARGET_EXTRACTOR);
     }
 
-    //@Ignore("no available example")
     @Test
     public void testExampleOutput() throws Exception {
         runToolCheckExit0("-o", TARGET_EXTRACTOR);

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/cli/src/test/java/org/apache/any23/cli/RoverTest.java
----------------------------------------------------------------------
diff --git a/cli/src/test/java/org/apache/any23/cli/RoverTest.java b/cli/src/test/java/org/apache/any23/cli/RoverTest.java
index 893220a..7bab314 100644
--- a/cli/src/test/java/org/apache/any23/cli/RoverTest.java
+++ b/cli/src/test/java/org/apache/any23/cli/RoverTest.java
@@ -23,7 +23,6 @@ import org.apache.any23.util.StringUtils;
 import org.apache.any23.util.URLUtils;
 import org.junit.Assert;
 import org.junit.Assume;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.eclipse.rdf4j.model.Statement;
 import org.eclipse.rdf4j.rio.RDFFormat;
@@ -36,7 +35,6 @@ import java.util.Arrays;
  *
  * @author Michele Mostarda (mostarda@fbk.eu)
  */
-@Ignore("Twitter microdata not parsing correctly right now")
 public class RoverTest extends ToolTestBase {
 
     private static final String[] TARGET_FILES = {

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/cli/src/test/java/org/apache/any23/cli/SimpleRoverTest.java
----------------------------------------------------------------------
diff --git a/cli/src/test/java/org/apache/any23/cli/SimpleRoverTest.java b/cli/src/test/java/org/apache/any23/cli/SimpleRoverTest.java
index f659539..b4c10ad 100644
--- a/cli/src/test/java/org/apache/any23/cli/SimpleRoverTest.java
+++ b/cli/src/test/java/org/apache/any23/cli/SimpleRoverTest.java
@@ -22,7 +22,6 @@ import java.util.Collection;
 import org.apache.any23.util.FileUtils;
 import org.apache.pdfbox.util.Charsets;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -104,7 +103,6 @@ public class SimpleRoverTest extends ToolTestBase {
      * @throws Exception 
      */
     @Test
-    @Ignore
     public void ref310ExtendedTest()
             throws Exception {
         File outputFile = File.createTempFile("rover-test", ".ttl", tempDirectory);

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/csv/CSVExtractor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/csv/CSVExtractor.java b/core/src/main/java/org/apache/any23/extractor/csv/CSVExtractor.java
index 7536304..e72162b 100644
--- a/core/src/main/java/org/apache/any23/extractor/csv/CSVExtractor.java
+++ b/core/src/main/java/org/apache/any23/extractor/csv/CSVExtractor.java
@@ -58,12 +58,15 @@ public class CSVExtractor implements Extractor.ContentExtractor {
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setStopAtFirstError(boolean f) {
+      //not implemented
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public void run(
             ExtractionParameters extractionParameters,
             ExtractionContext extractionContext,
@@ -85,7 +88,7 @@ public class CSVExtractor implements Extractor.ContentExtractor {
         String[] nextLine;
         int index = 0;
         while ((nextLine = csvParser.getLine()) != null) {
-            IRI rowSubject = RDFUtils.uri(
+            IRI rowSubject = RDFUtils.iri(
                     documentIRI.toString(),
                     "row/" + index
             );
@@ -194,11 +197,11 @@ public class CSVExtractor implements Extractor.ContentExtractor {
     }
 
     private IRI normalize(String toBeNormalized, IRI documentIRI) {
-        toBeNormalized = toBeNormalized.trim().toLowerCase().replace("?", "").replace("&", "");
+      String newToBeNormalized = toBeNormalized.trim().toLowerCase().replace("?", "").replace("&", "");
 
         StringBuilder result = new StringBuilder(documentIRI.toString());
 
-        StringTokenizer tokenizer = new StringTokenizer(toBeNormalized, " ");
+        StringTokenizer tokenizer = new StringTokenizer(newToBeNormalized, " ");
         while (tokenizer.hasMoreTokens()) {
             String current = tokenizer.nextToken();
 
@@ -228,7 +231,7 @@ public class CSVExtractor implements Extractor.ContentExtractor {
                 // there are some row cells that don't have an associated column name
                 break;
             }
-            if (cell.equals("")) {
+            if ("".equals(cell)) {
                 index++;
                 continue;
             }
@@ -241,17 +244,17 @@ public class CSVExtractor implements Extractor.ContentExtractor {
 
     private Value getObjectFromCell(String cell) {
         Value object;
-        cell = cell.trim();
-        if (RDFUtils.isAbsoluteIRI(cell)) {
-            object = SimpleValueFactory.getInstance().createIRI(cell);
+        String newCell = cell.trim();
+        if (RDFUtils.isAbsoluteIRI(newCell)) {
+            object = SimpleValueFactory.getInstance().createIRI(newCell);
         } else {
             IRI datatype = XMLSchema.STRING;
-            if (isInteger(cell)) {
+            if (isInteger(newCell)) {
                 datatype = XMLSchema.INTEGER;
-            } else if(isFloat(cell)) {
+            } else if(isFloat(newCell)) {
                 datatype = XMLSchema.FLOAT;
             }
-            object = SimpleValueFactory.getInstance().createLiteral(cell, datatype);
+            object = SimpleValueFactory.getInstance().createLiteral(newCell, datatype);
         }
         return object;
     }

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/html/EmbeddedJSONLDExtractor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/html/EmbeddedJSONLDExtractor.java b/core/src/main/java/org/apache/any23/extractor/html/EmbeddedJSONLDExtractor.java
index db58586..34728e5 100644
--- a/core/src/main/java/org/apache/any23/extractor/html/EmbeddedJSONLDExtractor.java
+++ b/core/src/main/java/org/apache/any23/extractor/html/EmbeddedJSONLDExtractor.java
@@ -28,7 +28,6 @@ import org.apache.any23.extractor.rdf.JSONLDExtractorFactory;
 import org.apache.any23.rdf.RDFUtils;
 import org.apache.any23.vocab.SINDICE;
 import org.eclipse.rdf4j.model.IRI;
-import org.eclipse.rdf4j.model.impl.LiteralImpl;
 import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
@@ -52,205 +51,167 @@ import java.util.Set;
  */
 public class EmbeddedJSONLDExtractor implements Extractor.TagSoupDOMExtractor {
 
-	private static final SINDICE vSINDICE = SINDICE.getInstance();
-
-	private IRI profile;
-
-	private Map<String, IRI> prefixes = new HashMap<>();
-
-	private String documentLang;
-
-	private JSONLDExtractor extractor;
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public void run(ExtractionParameters extractionParameters,
-			ExtractionContext extractionContext, Document in,
-			ExtractionResult out) throws IOException, ExtractionException {
-		profile = extractProfile(in);
-		documentLang = getDocumentLanguage(in);
-		extractLinkDefinedPrefixes(in);
-
-		String baseProfile = vSINDICE.NS;
-		if (profile != null) {
-			baseProfile = profile.toString();
-		}
-
-		final IRI documentIRI = extractionContext.getDocumentIRI();
-		Set<JSONLDScript> jsonldScripts = extractJSONLDScript(in, baseProfile,
-				extractionParameters, extractionContext, out);
-		for (JSONLDScript jsonldScript : jsonldScripts) {
-			//String lang = documentLang;
-			//if (jsonldScript.getLang() != null) {
-			//	lang = jsonldScript.getLang();
-			//}
-			//out.writeTriple(documentIRI, jsonldScript.getName(),
-			//		SimpleValueFactory.getInstance().createLiteral(jsonldScript.getContent(), lang));
-		}
-	}
-
-	/**
-	 * Returns the {@link Document} language if declared, <code>null</code>
-	 * otherwise.
-	 *
-	 * @param in
-	 *            a instance of {@link Document}.
-	 * @return the language declared, could be <code>null</code>.
-	 */
-	private String getDocumentLanguage(Document in) {
-		String lang = DomUtils.find(in, "string(/HTML/@lang)");
-		if (lang.equals("")) {
-			return null;
-		}
-		return lang;
-	}
-
-	private IRI extractProfile(Document in) {
-		String profile = DomUtils.find(in, "string(/HTML/@profile)");
-		if (profile.equals("")) {
-			return null;
-		}
-		return SimpleValueFactory.getInstance().createIRI(profile);
-	}
-
-	/**
-	 * It extracts prefixes defined in the <i>LINK</i> meta tags.
-	 *
-	 * @param in
-	 */
-	private void extractLinkDefinedPrefixes(Document in) {
-		List<Node> linkNodes = DomUtils.findAll(in, "/HTML/HEAD/LINK");
-		for (Node linkNode : linkNodes) {
-			NamedNodeMap attributes = linkNode.getAttributes();
-			String rel = attributes.getNamedItem("rel").getTextContent();
-			String href = attributes.getNamedItem("href").getTextContent();
-			if (rel != null && href != null && RDFUtils.isAbsoluteIRI(href)) {
-				prefixes.put(rel, SimpleValueFactory.getInstance().createIRI(href));
-			}
-		}
-	}
-
-	private Set<JSONLDScript> extractJSONLDScript(Document in,
-			String baseProfile, ExtractionParameters extractionParameters,
-			ExtractionContext extractionContext, ExtractionResult out)
-			throws IOException, ExtractionException {
-		List<Node> scriptNodes = DomUtils.findAll(in, "/HTML/HEAD/SCRIPT");
-		Set<JSONLDScript> result = new HashSet<>();
-		extractor = new JSONLDExtractorFactory().createExtractor();
-		for (Node jsonldNode : scriptNodes) {
-			NamedNodeMap attributes = jsonldNode.getAttributes();
-			for (int i = 0; i < attributes.getLength(); i++) {
-				if (attributes.item(i).getTextContent()
-						.equalsIgnoreCase("application/ld+json")) {
-					extractor.run(extractionParameters, extractionContext,
-							DomUtils.nodeToInputStream(jsonldNode
-									.getFirstChild()), out);
-				}
-			}
-			Node nameAttribute = attributes.getNamedItem("name");
-			Node contentAttribute = attributes.getNamedItem("content");
-			if (nameAttribute == null || contentAttribute == null) {
-				continue;
-			}
-			String name = nameAttribute.getTextContent();
-			String content = contentAttribute.getTextContent();
-			String xpath = DomUtils.getXPathForNode(jsonldNode);
-			IRI nameAsIRI = getPrefixIfExists(name);
-			if (nameAsIRI == null) {
-				nameAsIRI = SimpleValueFactory.getInstance().createIRI(baseProfile + name);
-			}
-			JSONLDScript jsonldScript = new JSONLDScript(xpath, nameAsIRI,
-					content);
-			result.add(jsonldScript);
-		}
-		return result;
-	}
-
-	private IRI getPrefixIfExists(String name) {
-		String[] split = name.split("\\.");
-		if (split.length == 2 && prefixes.containsKey(split[0])) {
-			return SimpleValueFactory.getInstance().createIRI(prefixes.get(split[0]) + split[1]);
-		}
-		return null;
-	}
-
-	@Override
-	public ExtractorDescription getDescription() {
-		return EmbeddedJSONLDExtractorFactory.getDescriptionInstance();
-	}
-
-	private class JSONLDScript {
-
-		private String xpath;
-
-		private IRI name;
-
-		private String lang;
-
-		private String content;
-
-		public JSONLDScript(String xpath, IRI name, String content) {
-			this.xpath = xpath;
-			this.name = name;
-			this.content = content;
-		}
-
-		public JSONLDScript(String xpath, IRI name, String content, String lang) {
-			this(xpath, name, content);
-			this.lang = lang;
-		}
-
-		public IRI getName() {
-			return name;
-		}
-
-		public void setName(IRI name) {
-			this.name = name;
-		}
-
-		public String getLang() {
-			return lang;
-		}
-
-		public void setLang(String lang) {
-			this.lang = lang;
-		}
-
-		public String getContent() {
-			return content;
-		}
-
-		public void setContent(String content) {
-			this.content = content;
-		}
-
-		@Override
-		public boolean equals(Object o) {
-			if (this == o) {
-				return true;
-			}
-			if (o == null) {
-				return false;
-			}
-			if (!(o instanceof JSONLDScript)) {
-				return false;
-			}
-
-			JSONLDScript meta = (JSONLDScript) o;
-
-			if (xpath != null ? !xpath.equals(meta.xpath) : meta.xpath != null) {
-				return false;
-			}
-
-			return true;
-		}
-
-		@Override
-		public int hashCode() {
-			return xpath != null ? xpath.hashCode() : 0;
-		}
-	}
+  private static final SINDICE vSINDICE = SINDICE.getInstance();
+
+  private IRI profile;
+
+  private Map<String, IRI> prefixes = new HashMap<>();
+
+  private String documentLang;
+
+  private JSONLDExtractor extractor;
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void run(ExtractionParameters extractionParameters,
+          ExtractionContext extractionContext, Document in,
+          ExtractionResult out) throws IOException, ExtractionException {
+    profile = extractProfile(in);
+    documentLang = getDocumentLanguage(in);
+    extractLinkDefinedPrefixes(in);
+
+    String baseProfile = vSINDICE.NS;
+    if (profile != null) {
+      baseProfile = profile.toString();
+    }
+
+    extractionContext.getDocumentIRI();
+    Set<JSONLDScript> jsonldScripts = extractJSONLDScript(in, baseProfile,
+            extractionParameters, extractionContext, out);
+    for (JSONLDScript jsonldScript : jsonldScripts) {
+      //String lang = documentLang;
+      //if (jsonldScript.getLang() != null) {
+      //	lang = jsonldScript.getLang();
+      //}
+      //out.writeTriple(documentIRI, jsonldScript.getName(),
+      //		SimpleValueFactory.getInstance().createLiteral(jsonldScript.getContent(), lang));
+    }
+  }
+
+  /**
+   * Returns the {@link Document} language if declared, <code>null</code>
+   * otherwise.
+   *
+   * @param in
+   *            a instance of {@link Document}.
+   * @return the language declared, could be <code>null</code>.
+   */
+  private String getDocumentLanguage(Document in) {
+    String lang = DomUtils.find(in, "string(/HTML/@lang)");
+    if ("".equals(lang)) {
+      return null;
+    }
+    return lang;
+  }
+
+  private IRI extractProfile(Document in) {
+    String profile = DomUtils.find(in, "string(/HTML/@profile)");
+    if ("".equals(profile)) {
+      return null;
+    }
+    return SimpleValueFactory.getInstance().createIRI(profile);
+  }
+
+  /**
+   * It extracts prefixes defined in the <i>LINK</i> meta tags.
+   *
+   * @param in
+   */
+  private void extractLinkDefinedPrefixes(Document in) {
+    List<Node> linkNodes = DomUtils.findAll(in, "/HTML/HEAD/LINK");
+    for (Node linkNode : linkNodes) {
+      NamedNodeMap attributes = linkNode.getAttributes();
+      String rel = attributes.getNamedItem("rel").getTextContent();
+      String href = attributes.getNamedItem("href").getTextContent();
+      if (rel != null && href != null && RDFUtils.isAbsoluteIRI(href)) {
+        prefixes.put(rel, SimpleValueFactory.getInstance().createIRI(href));
+      }
+    }
+  }
+
+  private Set<JSONLDScript> extractJSONLDScript(Document in,
+          String baseProfile, ExtractionParameters extractionParameters,
+          ExtractionContext extractionContext, ExtractionResult out)
+                  throws IOException, ExtractionException {
+    List<Node> scriptNodes = DomUtils.findAll(in, "/HTML/HEAD/SCRIPT");
+    Set<JSONLDScript> result = new HashSet<>();
+    extractor = new JSONLDExtractorFactory().createExtractor();
+    for (Node jsonldNode : scriptNodes) {
+      NamedNodeMap attributes = jsonldNode.getAttributes();
+      for (int i = 0; i < attributes.getLength(); i++) {
+        if ("application/ld+json".equalsIgnoreCase(attributes.item(i).getTextContent())) {
+          extractor.run(extractionParameters, extractionContext,
+                  DomUtils.nodeToInputStream(jsonldNode
+                          .getFirstChild()), out);
+        }
+      }
+      Node nameAttribute = attributes.getNamedItem("name");
+      Node contentAttribute = attributes.getNamedItem("content");
+      if (nameAttribute == null || contentAttribute == null) {
+        continue;
+      }
+      String name = nameAttribute.getTextContent();
+      String content = contentAttribute.getTextContent();
+      String xpath = DomUtils.getXPathForNode(jsonldNode);
+      IRI nameAsIRI = getPrefixIfExists(name);
+      if (nameAsIRI == null) {
+        nameAsIRI = SimpleValueFactory.getInstance().createIRI(baseProfile + name);
+      }
+      JSONLDScript jsonldScript = new JSONLDScript(xpath, nameAsIRI,
+              content);
+      result.add(jsonldScript);
+    }
+    return result;
+  }
+
+  private IRI getPrefixIfExists(String name) {
+    String[] split = name.split("\\.");
+    if (split.length == 2 && prefixes.containsKey(split[0])) {
+      return SimpleValueFactory.getInstance().createIRI(prefixes.get(split[0]) + split[1]);
+    }
+    return null;
+  }
+
+  @Override
+  public ExtractorDescription getDescription() {
+    return EmbeddedJSONLDExtractorFactory.getDescriptionInstance();
+  }
+
+  private class JSONLDScript {
+
+    private String xpath;
+
+    public JSONLDScript(String xpath, IRI name, String content) {
+      this.xpath = xpath;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) {
+        return true;
+      }
+      if (o == null) {
+        return false;
+      }
+      if (!(o instanceof JSONLDScript)) {
+        return false;
+      }
+
+      JSONLDScript meta = (JSONLDScript) o;
+
+      if (xpath != null ? !xpath.equals(meta.xpath) : meta.xpath != null) {
+        return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return xpath != null ? xpath.hashCode() : 0;
+    }
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/html/HTMLMetaExtractor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/html/HTMLMetaExtractor.java b/core/src/main/java/org/apache/any23/extractor/html/HTMLMetaExtractor.java
index e67ec42..a3c6550 100644
--- a/core/src/main/java/org/apache/any23/extractor/html/HTMLMetaExtractor.java
+++ b/core/src/main/java/org/apache/any23/extractor/html/HTMLMetaExtractor.java
@@ -26,7 +26,6 @@ import org.apache.any23.extractor.ExtractorDescription;
 import org.apache.any23.rdf.RDFUtils;
 import org.apache.any23.vocab.SINDICE;
 import org.eclipse.rdf4j.model.IRI;
-import org.eclipse.rdf4j.model.impl.LiteralImpl;
 import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
@@ -51,7 +50,7 @@ public class HTMLMetaExtractor implements Extractor.TagSoupDOMExtractor {
 
     private IRI profile;
 
-    private Map<String, IRI> prefixes = new HashMap<String, IRI>();
+    private Map<String, IRI> prefixes = new HashMap<>();
 
     private String documentLang;
 
@@ -82,25 +81,25 @@ public class HTMLMetaExtractor implements Extractor.TagSoupDOMExtractor {
                 lang = meta.getLang();
             }
             if(meta.isPragmaDirective){
-            	if(lang != null) {
-            		out.writeTriple(
+                if(lang != null) {
+                    out.writeTriple(
                         documentIRI,
                         meta.getHttpEquiv(),
                         SimpleValueFactory.getInstance().createLiteral(meta.getContent(), lang));
-            	} else {
+                } else {
                         out.writeTriple(
                                 documentIRI,
                                 meta.getHttpEquiv(),
                                 SimpleValueFactory.getInstance().createLiteral(meta.getContent()));
-            	}
-            }else {
-            	if(lang != null) {
-            		out.writeTriple(
+                }
+            } else {
+                if(lang != null) {
+                    out.writeTriple(
                         documentIRI,
                         meta.getName(),
                         SimpleValueFactory.getInstance().createLiteral(meta.getContent(), lang));
-            	} else {
-            		out.writeTriple(
+                } else {
+                    out.writeTriple(
                             documentIRI,
                             meta.getName(),
                             SimpleValueFactory.getInstance().createLiteral(meta.getContent()));
@@ -117,7 +116,7 @@ public class HTMLMetaExtractor implements Extractor.TagSoupDOMExtractor {
      */
     private String getDocumentLanguage(Document in) {
         String lang = DomUtils.find(in, "string(/HTML/@lang)");
-        if (lang.equals("")) {
+        if ("".equals(lang)) {
             return null;
         }
         return lang;
@@ -125,7 +124,7 @@ public class HTMLMetaExtractor implements Extractor.TagSoupDOMExtractor {
 
     private IRI extractProfile(Document in) {
         String profile = DomUtils.find(in, "string(/HTML/@profile)");
-        if (profile.equals("")) {
+        if ("".equals(profile)) {
             return null;
         }
         return SimpleValueFactory.getInstance().createIRI(profile);
@@ -150,7 +149,7 @@ public class HTMLMetaExtractor implements Extractor.TagSoupDOMExtractor {
 
     private Set<Meta> extractMetaElement(Document in, String baseProfile) {
         List<Node> metaNodes = DomUtils.findAll(in, "/HTML/HEAD/META");
-        Set<Meta> result = new HashSet<Meta>();
+        Set<Meta> result = new HashSet<>();
         for (Node metaNode : metaNodes) {
             NamedNodeMap attributes = metaNode.getAttributes();
             Node nameAttribute = attributes.getNamedItem("name");
@@ -223,6 +222,7 @@ public class HTMLMetaExtractor implements Extractor.TagSoupDOMExtractor {
             this.setPragmaDirective(true);
         }
 
+        @SuppressWarnings("unused")
         public Meta(String xpath, String content, IRI httpEquiv, String lang) {
             this(xpath,content,httpEquiv);
             this.lang = lang;
@@ -234,15 +234,12 @@ public class HTMLMetaExtractor implements Extractor.TagSoupDOMExtractor {
             this.content = content;
         }
 
+        @SuppressWarnings("unused")
         public Meta(String xpath, IRI name, String content, String lang) {
             this(xpath, name, content);
             this.lang = lang;
         }
 
-        public boolean isPragmaDirective(){
-            return isPragmaDirective;
-        }
-
         private void setPragmaDirective(boolean value){
             this.isPragmaDirective=value;
         }
@@ -251,42 +248,29 @@ public class HTMLMetaExtractor implements Extractor.TagSoupDOMExtractor {
             return httpEquiv;
         }
 
-        public void setHttpEquiv(IRI httpEquiv){
-            this.httpEquiv=httpEquiv;
-        }
-
         public IRI getName() {
             return name;
         }
 
-        public void setName(IRI name) {
-            this.name = name;
-        }
-
         public String getLang() {
             return lang;
         }
 
-        public void setLang(String lang) {
-            this.lang = lang;
-        }
-
         public String getContent() {
             return content;
         }
 
-        public void setContent(String content) {
-            this.content = content;
-        }
-
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (o == null || getClass() != o.getClass()) return false;
+            if (this == o)
+                return true;
+            if (o == null || getClass() != o.getClass())
+                return false;
 
             Meta meta = (Meta) o;
 
-            if (xpath != null ? !xpath.equals(meta.xpath) : meta.xpath != null) return false;
+            if (xpath != null ? !xpath.equals(meta.xpath) : meta.xpath != null)
+                return false;
 
             return true;
         }

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/microdata/Item.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/microdata/Item.java b/core/src/main/java/org/apache/any23/extractor/microdata/Item.java
index 04ffa66..769b0d2 100644
--- a/core/src/main/java/org/apache/any23/extractor/microdata/Item.java
+++ b/core/src/main/java/org/apache/any23/extractor/microdata/Item.java
@@ -30,11 +30,6 @@ public abstract class Item {
     private final String xpath;
 
     /**
-     * @return the <b>JSON</b> representation for this item.
-     */
-    public abstract String toJSON();
-
-    /**
      * Constructor.
      *
      * @param xpath xpath to this item in container document.
@@ -47,6 +42,11 @@ public abstract class Item {
     }
 
     /**
+     * @return the <b>JSON</b> representation for this item.
+     */
+    public abstract String toJSON();
+
+    /**
      * @return the item location in container document.
      */
     public String getXpath() {

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/microdata/ItemPropValue.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/microdata/ItemPropValue.java b/core/src/main/java/org/apache/any23/extractor/microdata/ItemPropValue.java
index 0688fb8..f32b468 100644
--- a/core/src/main/java/org/apache/any23/extractor/microdata/ItemPropValue.java
+++ b/core/src/main/java/org/apache/any23/extractor/microdata/ItemPropValue.java
@@ -31,7 +31,17 @@ import org.apache.any23.util.StringUtils;
  */
 public class ItemPropValue {
 
-    private static final ThreadLocal<SimpleDateFormat> sdf = new ThreadLocal<SimpleDateFormat>();
+    /**
+     * Internal content value.
+     */
+    private final Object content;
+
+    /**
+     * Content type.
+     */
+    private final Type type;
+
+    private static final ThreadLocal<SimpleDateFormat> sdf = new ThreadLocal<>();
 
     /**
      * Supported types.
@@ -61,16 +71,6 @@ public class ItemPropValue {
     }
 
     /**
-     * Internal content value.
-     */
-    private final Object content;
-
-    /**
-     * Content type.
-     */
-    private final Type type;
-
-    /**
      * Constructor.
      *
      * @param content content object.
@@ -94,12 +94,11 @@ public class ItemPropValue {
             );
         }
         if(content instanceof String && ((String) content).trim().length() == 0) {
-            content = "Null";
             // ANY23-115 Empty spans seem to break ANY23
             // instead of throwing the exception and in effect failing the entire
             // parse job we wish to be lenient on web content publishers and add
             // Null (String) as content.
-            //throw new IllegalArgumentException("Invalid content '" + content + "'");
+            content = "Null";
         }
         this.content = content;
         this.type = type;
@@ -151,7 +150,8 @@ public class ItemPropValue {
      * @return <code>true</code> if type is an integer.
      */
     public boolean isInteger() {
-        if(type != Type.Plain) return false;
+        if(type != Type.Plain)
+            return false;
          try {
              Integer.parseInt((String) content);
              return true;
@@ -164,7 +164,8 @@ public class ItemPropValue {
      * @return <code>true</code> if type is a float.
      */
      public boolean isFloat() {
-         if(type != Type.Plain) return false;
+         if(type != Type.Plain)
+             return false;
          try {
              Float.parseFloat((String) content);
              return true;

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/microdata/ItemScope.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/microdata/ItemScope.java b/core/src/main/java/org/apache/any23/extractor/microdata/ItemScope.java
index 5f817f5..f36828a 100644
--- a/core/src/main/java/org/apache/any23/extractor/microdata/ItemScope.java
+++ b/core/src/main/java/org/apache/any23/extractor/microdata/ItemScope.java
@@ -87,17 +87,17 @@ public class ItemScope extends Item {
         this.refs = refs;
         this.itemId = itemId;
 
-        final Map<String, List<ItemProp>> tmpProperties = new HashMap<String, List<ItemProp>>();
+        final Map<String, List<ItemProp>> tmpProperties = new HashMap<>();
         for (ItemProp itemProp : itemProps) {
             final String propName = itemProp.getName();
             List<ItemProp> propList = tmpProperties.get(propName);
             if (propList == null) {
-                propList = new ArrayList<ItemProp>();
+                propList = new ArrayList<>();
                 tmpProperties.put(propName, propList);
             }
             propList.add(itemProp);
         }
-        final Map<String, List<ItemProp>> properties = new HashMap<String, List<ItemProp>>();
+        final Map<String, List<ItemProp>> properties = new HashMap<>();
         for (Map.Entry<String, List<ItemProp>> propertiesEntry : tmpProperties.entrySet()) {
             properties.put(
                     propertiesEntry.getKey(),
@@ -147,7 +147,8 @@ public class ItemScope extends Item {
     @Override
     public String toJSON() {
         StringBuilder sb = new StringBuilder();
-        int i, j;
+        int i;
+        int j;
         final Collection<List<ItemProp>> itemPropsList = properties.values();
         j = 0;
         for (List<ItemProp> itemProps : itemPropsList) {
@@ -184,12 +185,12 @@ public class ItemScope extends Item {
 
     @Override
     public int hashCode() {
-	int i = properties == null ? 0 : properties.hashCode();
-	i += id == null         ? 0 : id.hashCode();
-	i += refs == null       ? 0 : refs.hashCode();
-	i += type == null       ? 0 : type.hashCode();
-	i += itemId == null     ? 0 : itemId.hashCode();
-	return i;
+        int i = properties == null ? 0 : properties.hashCode();
+        i += id == null         ? 0 : id.hashCode();
+        i += refs == null       ? 0 : Arrays.hashCode(refs);
+        i += type == null       ? 0 : type.hashCode();
+        i += itemId == null     ? 0 : itemId.hashCode();
+        return i;
     }
 
     @Override
@@ -221,15 +222,17 @@ public class ItemScope extends Item {
     protected void acquireProperty(ItemProp itemProp) {
         List<ItemProp> itemProps = properties.get(itemProp.getName());
         if (itemProps == null) {
-            itemProps = new ArrayList<ItemProp>();
+            itemProps = new ArrayList<>();
             properties.put(itemProp.getName(), itemProps);
         }
-        if (!itemProps.contains(itemProp)) itemProps.add(itemProp);
+        if (!itemProps.contains(itemProp))
+            itemProps.add(itemProp);
     }
 
     protected void disownProperty(ItemProp itemProp) {
         List<ItemProp> propList = properties.get(itemProp.getName());
-        if (propList != null) propList.remove(itemProp);
+        if (propList != null)
+            propList.remove(itemProp);
     }
 
     private String toJSON(String[] in) {

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/microdata/MicrodataExtractor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/microdata/MicrodataExtractor.java b/core/src/main/java/org/apache/any23/extractor/microdata/MicrodataExtractor.java
index 636f4d2..aa01dfe 100644
--- a/core/src/main/java/org/apache/any23/extractor/microdata/MicrodataExtractor.java
+++ b/core/src/main/java/org/apache/any23/extractor/microdata/MicrodataExtractor.java
@@ -106,7 +106,7 @@ public class MicrodataExtractor implements Extractor.TagSoupDOMExtractor {
          * 5.2.6
          */
         final IRI documentIRI = extractionContext.getDocumentIRI();
-        final Map<ItemScope, Resource> mappings = new HashMap<ItemScope, Resource>();
+        final Map<ItemScope, Resource> mappings = new HashMap<>();
         for (ItemScope itemScope : itemScopes) {
             Resource subject = processType(itemScope, documentIRI, out, mappings);
             out.writeTriple(
@@ -143,7 +143,7 @@ public class MicrodataExtractor implements Extractor.TagSoupDOMExtractor {
      */
     private String getDocumentLanguage(Document in) {
         String lang = DomUtils.find(in, "string(/HTML/@lang)");
-        if (lang.equals("")) {
+        if ("".equals(lang)) {
             return null;
         }
         return lang;
@@ -256,13 +256,13 @@ public class MicrodataExtractor implements Extractor.TagSoupDOMExtractor {
             }
         }
         String[] relTokens = rel.getTextContent().split(" ");
-        Set<String> tokensWithNoDuplicates = new HashSet<String>();
+        Set<String> tokensWithNoDuplicates = new HashSet<>();
         for (String relToken : relTokens) {
             if (relToken.contains(":")) {
                 // if contain semi-colon, skip
                 continue;
             }
-            if (relToken.equals("alternate") || relToken.equals("stylesheet")) {
+            if ("alternate".equals(relToken) || "stylesheet".equals(relToken)) {
                 tokensWithNoDuplicates.add("ALTERNATE-STYLESHEET");
                 continue;
             }
@@ -295,7 +295,7 @@ public class MicrodataExtractor implements Extractor.TagSoupDOMExtractor {
         NodeList metas = in.getElementsByTagName("meta");
         for (int i = 0; i < metas.getLength(); i++) {
             Node meta = metas.item(i);
-            String name    = DomUtils.readAttribute(meta, "name"   , null);
+            String name    = DomUtils.readAttribute(meta, "name", null);
             String content = DomUtils.readAttribute(meta, "content", null);
             if (name != null && content != null) {
                 if (isAbsoluteURL(name)) {
@@ -482,20 +482,18 @@ public class MicrodataExtractor implements Extractor.TagSoupDOMExtractor {
             ExtractionResult out
     ) throws MalformedURLException, ExtractionException {
         IRI predicate;
-        if (!isAbsoluteURL(propName) && itemScopeType.equals("") && isStrict) {
+        if (!isAbsoluteURL(propName) && "".equals(itemScopeType) && isStrict) {
             return;
-        } else if (!isAbsoluteURL(propName) && itemScopeType.equals("") && !isStrict) {
+        } else if (!isAbsoluteURL(propName) && "".equals(itemScopeType) && !isStrict) {
             predicate = RDFUtils.iri(toAbsoluteURL(
-			        defaultNamespace,
-			        propName,
-			        '/'
-			).toString());
+                    defaultNamespace,
+                    propName,
+                    '/').toString());
         } else {
             predicate = RDFUtils.iri(toAbsoluteURL(
-			        itemScopeType,
-			        propName,
-			        '/'
-			).toString());
+                    itemScopeType,
+                    propName,
+                    '/').toString());
         }
         Value value;
         Object propValue = itemProp.getValue().getContent();
@@ -506,10 +504,9 @@ public class MicrodataExtractor implements Extractor.TagSoupDOMExtractor {
             value = RDFUtils.literal((String) propValue, documentLanguage);
         } else if (propType.equals(ItemPropValue.Type.Link)) {
             value = RDFUtils.iri(toAbsoluteURL(
-			        documentIRI.toString(),
-			        (String) propValue,
-			        '/'
-			).toString());
+                    documentIRI.toString(),
+                    (String) propValue,
+                    '/').toString());
         } else if (propType.equals(ItemPropValue.Type.Date)) {
             value = RDFUtils.literal(ItemPropValue.formatDateTime((Date) propValue), XMLSchema.DATE);
         } else {

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/microdata/MicrodataParser.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/microdata/MicrodataParser.java b/core/src/main/java/org/apache/any23/extractor/microdata/MicrodataParser.java
index 147fd18..cf05e35 100644
--- a/core/src/main/java/org/apache/any23/extractor/microdata/MicrodataParser.java
+++ b/core/src/main/java/org/apache/any23/extractor/microdata/MicrodataParser.java
@@ -48,54 +48,36 @@ public class MicrodataParser {
 
     enum ErrorMode {
         /** This mode raises an exception at first encountered error. */
-        StopAtFirstError,
+        STOP_AT_FIRST_ERROR,
         /**  This mode produces a full error report. */
-        FullReport
+        FULL_REPORT
     }
 
-    public static final String ITEMSCOPE_ATTRIBUTE = "itemscope";
-    public static final String ITEMPROP_ATTRIBUTE  = "itemprop";
-
-    /**
-     * List of tags providing the <code>src</code> property.
-     */
-    public static final Set<String> SRC_TAGS =  Collections.unmodifiableSet(
-            new HashSet<String>( Arrays.asList("audio", "embed", "frame", "iframe", "img", 
-              "source", "track", "video", "input", "layer", "script", "textarea") )
-    );
-
-    /**
-     * List of tags providing the <code>href</code> property.
-     */
-    public static final Set<String> HREF_TAGS =  Collections.unmodifiableSet(
-            new HashSet<String>( Arrays.asList("a", "area", "link") )
-    );
-
     private final Document document;
 
     /**
      * This set holds the name of properties being dereferenced.
-     * The {@link #deferProperties(String...)} checks first if the
+     * The {@link #deferProperties(Node, String...)} checks first if the
      * required dereference has been already asked, if so raises
      * a loop detection error. This map works in coordination
      * with {@link #dereferenceRecursionCounter}, so that at the end of
-     * {@link #deferProperties(String...)} call recursion the
+     * {@link #deferProperties(Node, String...)} call recursion the
      * {@link #loopDetectorSet} can be cleaned up.
      */
-    private final Set<String> loopDetectorSet = new HashSet<String>();
+    private final Set<String> loopDetectorSet = new HashSet<>();
 
     /**
      * {@link ItemScope} cache.
      */
-    private final Map<Node,ItemScope> itemScopes = new HashMap<Node,ItemScope>();
+    private final Map<Node,ItemScope> itemScopes = new HashMap<>();
 
     /**
      * {@link ItemPropValue} cache.
      */
-    private final Map<Node, ItemPropValue> itemPropValues = new HashMap<Node, ItemPropValue>();
+    private final Map<Node, ItemPropValue> itemPropValues = new HashMap<>();
 
    /**
-     * Counts the recursive call of {@link #deferProperties(String...)}.
+     * Counts the recursive call of {@link #deferProperties(Node, String...)}.
      * It helps to cleanup the {@link #loopDetectorSet} when recursion ends.
      */
     private int dereferenceRecursionCounter = 0;
@@ -103,12 +85,37 @@ public class MicrodataParser {
     /**
      * Current error mode.
      */
-    private ErrorMode errorMode = ErrorMode.FullReport;
+    private ErrorMode errorMode = ErrorMode.FULL_REPORT;
 
     /**
      * List of collected errors. Used when {@link #errorMode} <code>==</code> {@link ErrorMode#FullReport}.
      */
-    private List<MicrodataParserException> errors = new ArrayList<MicrodataParserException>();
+    private List<MicrodataParserException> errors = new ArrayList<>();
+
+    public static final String ITEMSCOPE_ATTRIBUTE = "itemscope";
+    public static final String ITEMPROP_ATTRIBUTE  = "itemprop";
+
+    /**
+     * List of tags providing the <code>src</code> property.
+     */
+    public static final Set<String> SRC_TAGS =  Collections.unmodifiableSet(
+            new HashSet<String>( Arrays.asList("audio", "embed", "frame", "iframe", "img", 
+              "source", "track", "video", "input", "layer", "script", "textarea") )
+    );
+
+    /**
+     * List of tags providing the <code>href</code> property.
+     */
+    public static final Set<String> HREF_TAGS =  Collections.unmodifiableSet(
+            new HashSet<String>( Arrays.asList("a", "area", "link") )
+    );
+
+    public MicrodataParser(Document document) {
+      if(document == null) {
+          throw new NullPointerException("Document cannot be null.");
+      }
+      this.document = document;
+    }
 
     /**
      * Returns all the <i>itemScope</i>s detected within the given root node.
@@ -158,7 +165,7 @@ public class MicrodataParser {
      */
     public static List<Node> getTopLevelItemScopeNodes(Node node)  {
         final List<Node> itemScopes = getItemScopeNodes(node);
-        final List<Node> topLevelItemScopes = new ArrayList<Node>();
+        final List<Node> topLevelItemScopes = new ArrayList<>();
         for(Node itemScope : itemScopes) {
             if( ! isItemProp(itemScope) ) {
                 topLevelItemScopes.add(itemScope);
@@ -176,13 +183,13 @@ public class MicrodataParser {
      * @param errorMode error management policy.
      * @return list of <b>itemscope</b> items.
      * @throws MicrodataParserException if
-     *         <code>errorMode == {@link org.apache.any23.extractor.microdata.MicrodataParser.ErrorMode#StopAtFirstError}</code>
+     *         <code>errorMode == {@link org.apache.any23.extractor.microdata.MicrodataParser.ErrorMode#STOP_AT_FIRST_ERROR}</code>
      *         and an error occurs.
      */
     public static MicrodataParserReport getMicrodata(Document document, ErrorMode errorMode)
     throws MicrodataParserException {
         final List<Node> itemNodes = getTopLevelItemScopeNodes(document);
-        final List<ItemScope> items = new ArrayList<ItemScope>();
+        final List<ItemScope> items = new ArrayList<>();
         final MicrodataParser microdataParser = new MicrodataParser(document);
         microdataParser.setErrorMode(errorMode);
         for(Node itemNode : itemNodes) {
@@ -203,7 +210,7 @@ public class MicrodataParser {
      */
     public static MicrodataParserReport getMicrodata(Document document) {
         try {
-            return getMicrodata(document, ErrorMode.FullReport);
+            return getMicrodata(document, ErrorMode.FULL_REPORT);
         } catch (MicrodataParserException mpe) {
              throw new IllegalStateException("Unexpected exception.", mpe);
         }
@@ -255,12 +262,14 @@ public class MicrodataParser {
      * @param candidates list of candidate nodes.
      * @return list of unnested nodes.
      */
+    @SuppressWarnings("unused")
     private static List<Node> getUnnestedNodes(List<Node> candidates) {
-        final List<Node> unnesteds  = new ArrayList<Node>();
+        final List<Node> unnesteds  = new ArrayList<>();
         for(int i = 0; i < candidates.size(); i++) {
             boolean skip = false;
             for(int j = 0; j < candidates.size(); j++) {
-                if(i == j) continue;
+                if(i == j)
+                    continue;
                 if( DomUtils.isAncestorOf(candidates.get(j), candidates.get(i), true) ) {
                     skip = true;
                     break;
@@ -273,15 +282,9 @@ public class MicrodataParser {
         return unnesteds;
     }
 
-    public MicrodataParser(Document document) {
-        if(document == null) {
-            throw new NullPointerException("Document cannot be null.");
-        }
-        this.document = document;
-    }
-
     public void setErrorMode(ErrorMode errorMode) {
-        if(errorMode == null) throw new IllegalArgumentException("errorMode must be not null.");
+        if(errorMode == null)
+            throw new IllegalArgumentException("errorMode must be not null.");
         this.errorMode = errorMode;
     }
 
@@ -306,7 +309,8 @@ public class MicrodataParser {
      */
     public ItemPropValue getPropertyValue(Node node) throws MicrodataParserException {
         final ItemPropValue itemPropValue = itemPropValues.get(node);
-        if(itemPropValue != null) return itemPropValue;
+        if(itemPropValue != null)
+            return itemPropValue;
 
         final String nodeName = node.getNodeName().toLowerCase();
         if (DomUtils.hasAttribute(node, "content")) {
@@ -338,7 +342,7 @@ public class MicrodataParser {
         }
 
         if( isItemScope(node) ) {
-            return new ItemPropValue( getItemScope(node), ItemPropValue.Type.Nested );
+            return new ItemPropValue( getItemScope(node), ItemPropValue.Type.Nested);
         }
 
         final ItemPropValue newItemPropValue = new ItemPropValue( node.getTextContent(), ItemPropValue.Type.Plain);
@@ -356,7 +360,7 @@ public class MicrodataParser {
      * @throws MicrodataParserException if an error occurs while retrieving an property value.
      */
     public List<ItemProp> getItemProps(final Node scopeNode, boolean skipRoot) throws MicrodataParserException {
-        final Set<Node> accepted = new LinkedHashSet<Node>();
+        final Set<Node> accepted = new LinkedHashSet<>();
 
         if (!skipRoot) {
             NamedNodeMap attributes = scopeNode.getAttributes();
@@ -375,19 +379,20 @@ public class MicrodataParser {
                     if (attributes.getNamedItem(ITEMPROP_ATTRIBUTE) != null && !scopeNode.equals(node)) {
                         accepted.add(node);
                     }
-                    if (attributes.getNamedItem(ITEMSCOPE_ATTRIBUTE) != null) {
-                        // Don't visit descendants of nodes that define a new scope
-                        return FILTER_REJECT;
-                    }
+//                    ANY23-131 Nested Microdata are not extracted
+//                    if (attributes.getNamedItem(ITEMSCOPE_ATTRIBUTE) != null) {
+//                        // Don't visit descendants of nodes that define a new scope
+//                        return FILTER_REJECT;
+//                    }
                 }
                 return FILTER_ACCEPT;
             }
         }, false);
 
         // To populate accepted we only need to walk the tree.
-    	while (treeWalker.nextNode() != null);
+        while (treeWalker.nextNode() != null);
 
-        final List<ItemProp> result = new ArrayList<ItemProp>();
+        final List<ItemProp> result = new ArrayList<>();
         for(Node itemPropNode :  accepted) {
             final String itemProp = DomUtils.readAttribute(itemPropNode, ITEMPROP_ATTRIBUTE, null);
             final String[] propertyNames = itemProp.split(" ");
@@ -414,14 +419,15 @@ public class MicrodataParser {
     /**
      * Given a document and a list of <b>itemprop</b> names this method will return
      * such <b>itemprops</b>.
-     *
+     * 
+     * @param node a {@link org.w3c.dom.Node} to which the refs belong
      * @param refs list of references.
      * @return list of retrieved <b>itemprop</b>s.
      * @throws MicrodataParserException if a loop is detected or a property name is missing.
      */
-    public ItemProp[] deferProperties(String... refs) throws MicrodataParserException {
+    public ItemProp[] deferProperties(Node node, String... refs) throws MicrodataParserException {
         dereferenceRecursionCounter++;
-        final List<ItemProp> result = new ArrayList<ItemProp>();
+        final List<ItemProp> result = new ArrayList<>();
         try {
             for (String ref : refs) {
                 if (loopDetectorSet.contains(ref)) {
@@ -434,18 +440,22 @@ public class MicrodataParser {
                         );
                 }
                 loopDetectorSet.add(ref);
-                final Element element = document.getElementById(ref);
+                Element element = (Element) node;
                 if (element == null) {
                     manageError(
                             new MicrodataParserException( String.format("Unknown itemProp id '%s'", ref ), null )
                     );
                     continue;
                 }
-                result.addAll(getItemProps(element, false));
+                List<ItemProp> propList = getItemProps(element, false);
+                if (!result.containsAll(propList)) {
+                  result.addAll(propList);
+                }
             }
         } catch (MicrodataParserException mpe) {
             if(dereferenceRecursionCounter == 1)
-                manageError(mpe); else throw mpe;  // Recursion end, this the the top call.
+                manageError(mpe);
+            else throw mpe;  // Recursion end, this the the top call.
         } finally {
             dereferenceRecursionCounter--;
             if(dereferenceRecursionCounter == 0) { // Recursion end, this the the top call.
@@ -464,7 +474,8 @@ public class MicrodataParser {
      */
     public ItemScope getItemScope(Node node) throws MicrodataParserException {
         final ItemScope itemScope = itemScopes.get(node);
-        if(itemScope != null) return itemScope;
+        if(itemScope != null)
+            return itemScope;
 
         final String id       = DomUtils.readAttribute(node, "id"      , null);
         final String itemref  = DomUtils.readAttribute(node, "itemref" , null);
@@ -475,7 +486,7 @@ public class MicrodataParser {
         final String[] itemrefIDs = itemref == null ? new String[0] : itemref.split(" ");
         final ItemProp[] deferredProperties;
         try {
-            deferredProperties = deferProperties(itemrefIDs);
+            deferredProperties = deferProperties(node, itemrefIDs);
         } catch (MicrodataParserException mpe) {
             mpe.setErrorNode(node);
             throw mpe;
@@ -506,12 +517,13 @@ public class MicrodataParser {
     }
 
     private void manageError(MicrodataParserException mpe) throws MicrodataParserException {
-        if(errorMode == ErrorMode.StopAtFirstError) {
+        if(errorMode == ErrorMode.STOP_AT_FIRST_ERROR) {
             throw mpe;
         }
-        if(errorMode != ErrorMode.FullReport) throw new IllegalStateException("Unsupported mode " + errorMode);
+        if(errorMode != ErrorMode.FULL_REPORT)
+            throw new IllegalStateException("Unsupported mode " + errorMode);
         if(errors == null) {
-            errors = new ArrayList<MicrodataParserException>();
+            errors = new ArrayList<>();
         }
         errors.add(mpe);
     }

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/xpath/QuadTemplate.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/xpath/QuadTemplate.java b/core/src/main/java/org/apache/any23/extractor/xpath/QuadTemplate.java
index 8fef9b1..dc0eaeb 100644
--- a/core/src/main/java/org/apache/any23/extractor/xpath/QuadTemplate.java
+++ b/core/src/main/java/org/apache/any23/extractor/xpath/QuadTemplate.java
@@ -117,6 +117,7 @@ public class QuadTemplate {
     public void printOut(ExtractionResult er, Map<String,String> variableAssignment) {
         final Resource s = subject.getValue(variableAssignment);
         final IRI p      = predicate.getValue(variableAssignment);
+        @SuppressWarnings("unchecked")
         final Value o    = object.getValue(variableAssignment);
         if(graph != null) {
             final IRI g = graph.getValue(variableAssignment);

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/xpath/TemplateObject.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/xpath/TemplateObject.java b/core/src/main/java/org/apache/any23/extractor/xpath/TemplateObject.java
index d9156a5..95d7b0d 100644
--- a/core/src/main/java/org/apache/any23/extractor/xpath/TemplateObject.java
+++ b/core/src/main/java/org/apache/any23/extractor/xpath/TemplateObject.java
@@ -18,7 +18,6 @@
 package org.apache.any23.extractor.xpath;
 
 import org.eclipse.rdf4j.model.Value;
-import org.eclipse.rdf4j.model.impl.BNodeImpl;
 import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
 
 /**
@@ -32,9 +31,9 @@ public class TemplateObject extends Term {
      * Supported object types.
      */
     public enum Type {
-        uri,
-        bnode,
-        literal
+        URI,
+        BNODE,
+        LITERAL
     }
 
     /**
@@ -61,33 +60,37 @@ public class TemplateObject extends Term {
     @Override
     protected Value getValueInternal(String value) {
         switch (type) {
-            case uri:
-                try {
-                    return SimpleValueFactory.getInstance().createIRI(value);
-                } catch (IllegalArgumentException iae) {
-                    throw new IllegalArgumentException(
-                            String.format("Expected a valid IRI for object template, found '%s'", value),
-                            iae
-                    );
-                }
-            case bnode:
+            case URI:
+                return createIRI(value);
+            case BNODE:
                 return SimpleValueFactory.getInstance().createBNode(value);
-            case literal:
+            case LITERAL:
                 return SimpleValueFactory.getInstance().createLiteral(value);
             default:
                 throw new IllegalStateException();
         }
     }
 
+    private Value createIRI(String value) {
+        try {
+            return SimpleValueFactory.getInstance().createIRI(value);
+        } catch (IllegalArgumentException iae) {
+            throw new IllegalArgumentException(
+                String.format("Expected a valid IRI for object template, found '%s'", value),
+                iae
+            );
+        }
+    }
+
     @Override
     public String toString() {
         final String superStr = super.toString();
         switch (type) {
-            case uri:
+            case URI:
                 return "<" + superStr + ">";
-            case bnode:
+            case BNODE:
                 return "_:" + superStr;
-            case literal:
+            case LITERAL:
                 return "'" + superStr + "'";
             default:
                 throw new IllegalStateException();

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/xpath/TemplateSubject.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/xpath/TemplateSubject.java b/core/src/main/java/org/apache/any23/extractor/xpath/TemplateSubject.java
index a4ce270..80c8e57 100644
--- a/core/src/main/java/org/apache/any23/extractor/xpath/TemplateSubject.java
+++ b/core/src/main/java/org/apache/any23/extractor/xpath/TemplateSubject.java
@@ -18,7 +18,6 @@
 package org.apache.any23.extractor.xpath;
 
 import org.eclipse.rdf4j.model.Resource;
-import org.eclipse.rdf4j.model.impl.BNodeImpl;
 import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
 
 /**
@@ -32,8 +31,8 @@ public class TemplateSubject extends Term<Resource> {
      * Supported subject types.
      */
     public enum Type {
-        uri,
-        bnode
+        URI,
+        BNODE
     }
 
     /**
@@ -60,9 +59,9 @@ public class TemplateSubject extends Term<Resource> {
     @Override
     protected Resource getValueInternal(String value) {
         switch (type) {
-            case uri:
+            case URI:
                 return SimpleValueFactory.getInstance().createIRI(value);
-            case bnode:
+            case BNODE:
                 return SimpleValueFactory.getInstance().createBNode(value);
             default:
                 throw new IllegalStateException();
@@ -73,9 +72,9 @@ public class TemplateSubject extends Term<Resource> {
     public String toString() {
         final String superStr = super.toString();
         switch (type) {
-            case uri:
+            case URI:
                 return "<" + superStr + ">";
-            case bnode:
+            case BNODE:
                 return "_:" + superStr;
             default:
                 throw new IllegalStateException();

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/extractor/yaml/ElementsProcessor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/extractor/yaml/ElementsProcessor.java b/core/src/main/java/org/apache/any23/extractor/yaml/ElementsProcessor.java
index bacb90c..90863ac 100644
--- a/core/src/main/java/org/apache/any23/extractor/yaml/ElementsProcessor.java
+++ b/core/src/main/java/org/apache/any23/extractor/yaml/ElementsProcessor.java
@@ -58,6 +58,10 @@ public class ElementsProcessor {
 
     private static final ElementsProcessor _ep = new ElementsProcessor();
 
+    // hide constructor
+    private ElementsProcessor() {
+    }
+
     /**
      * A model holder describes the two required parameters which makes a model useful
      * in further processing: a root node and model itself.
@@ -66,6 +70,11 @@ public class ElementsProcessor {
         private final Value root;
         private final Model model;
 
+        public ModelHolder(Value root, Model model) {
+            this.root = root;
+            this.model = model;
+        }
+
         public Value getRoot() {
             return root;
         }
@@ -73,11 +82,6 @@ public class ElementsProcessor {
         public Model getModel() {
             return model;
         }
-
-        public ModelHolder(Value root, Model model) {
-            this.root = root;
-            this.model = model;
-        }
     }
     
     
@@ -100,15 +104,16 @@ public class ElementsProcessor {
      * created.
      * @return instance of {@link ModelHolder},
      */
+    @SuppressWarnings("unchecked")
     public ModelHolder asModel(IRI namespace, final Object t, Value rootNode) {
         if (t == null) {
             return null;
         }
 
         if (t instanceof List) {
-            return processList(namespace, (List) t);
+            return processList(namespace, (List<Object>) t);
         } else if (t instanceof Map) {
-            return processMap(namespace, (Map) t, rootNode);
+            return processMap(namespace, (Map<String, Object>) t, rootNode);
         } else if (t instanceof String) {
             return asModelHolder(RDFUtils.makeIRI(t.toString()), modelFactory.createEmptyModel());
         } else {
@@ -174,7 +179,6 @@ public class ElementsProcessor {
         return asModelHolder(nodeURI, model);
     }
 
-    @SuppressWarnings("UnusedAssignment")
     protected ModelHolder processList(IRI ns, List<Object> object) {
 
         if (object.isEmpty() || object.stream().noneMatch((i) -> {
@@ -217,10 +221,6 @@ public class ElementsProcessor {
         return asModelHolder(listRoot, finalModel);
     }
 
-    // hide constructor
-    private ElementsProcessor() {
-    }
-
     public static final ElementsProcessor getInstance() {
         return _ep;
     }

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java b/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
index c6efba8..0cbc78c 100644
--- a/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
+++ b/core/src/main/java/org/apache/any23/rdf/Any23ValueFactoryWrapper.java
@@ -29,7 +29,6 @@ import org.eclipse.rdf4j.model.Statement;
 import org.eclipse.rdf4j.model.IRI;
 import org.eclipse.rdf4j.model.Value;
 import org.eclipse.rdf4j.model.ValueFactory;
-import org.eclipse.rdf4j.model.impl.ValueFactoryBase;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -90,73 +89,90 @@ public class Any23ValueFactoryWrapper implements ValueFactory {
         return defaultLiteralLanguage;
     }
 
+    @Override
     public BNode createBNode() {
         return wrappedFactory.createBNode();
     }
 
+    @Override
     public BNode createBNode(String id) {
-        if (id == null) return null;
+        if (id == null)
+            return null;
         return wrappedFactory.createBNode(id);
     }
 
+    @Override
     public Literal createLiteral(String content) {
-        if (content == null) return null;
+        if (content == null)
+            return null;
         if (defaultLiteralLanguage == null) {
-        	return wrappedFactory.createLiteral(content);
+            return wrappedFactory.createLiteral(content);
         } else {
-        	return wrappedFactory.createLiteral(content, defaultLiteralLanguage);
+            return wrappedFactory.createLiteral(content, defaultLiteralLanguage);
         }
     }
 
+    @Override
     public Literal createLiteral(boolean b) {
         return wrappedFactory.createLiteral(b);
     }
 
+    @Override
     public Literal createLiteral(byte b) {
         return wrappedFactory.createLiteral(b);
     }
 
+    @Override
     public Literal createLiteral(short i) {
         return wrappedFactory.createLiteral(i);
     }
 
+    @Override
     public Literal createLiteral(int i) {
         return wrappedFactory.createLiteral(i);
     }
 
+    @Override
     public Literal createLiteral(long l) {
         return wrappedFactory.createLiteral(l);
     }
 
+    @Override
     public Literal createLiteral(float v) {
         return wrappedFactory.createLiteral(v);
     }
 
+    @Override
     public Literal createLiteral(double v) {
         return wrappedFactory.createLiteral(v);
     }
 
-	@Override
-	public Literal createLiteral(BigDecimal v) {
+    @Override
+    public Literal createLiteral(BigDecimal v) {
         return wrappedFactory.createLiteral(v);
-	}
+    }
 
-	@Override
-	public Literal createLiteral(BigInteger v) {
+    @Override
+    public Literal createLiteral(BigInteger v) {
         return wrappedFactory.createLiteral(v);
-	}
+    }
 
+    @Override
     public Literal createLiteral(XMLGregorianCalendar calendar) {
         return wrappedFactory.createLiteral(calendar);
     }
 
+    @Override
     public Literal createLiteral(String label, String language) {
-        if (label == null) return null;
+        if (label == null)
+            return null;
         return wrappedFactory.createLiteral(label, language);
     }
 
+    @Override
     public Literal createLiteral(String pref, IRI value) {
-        if (pref == null) return null;
+        if (pref == null)
+            return null;
         return wrappedFactory.createLiteral(pref, value);
     }
 
@@ -165,6 +181,7 @@ public class Any23ValueFactoryWrapper implements ValueFactory {
         return wrappedFactory.createLiteral(date);
     }
 
+    @Override
     public Statement createStatement(Resource sub, IRI pre, Value obj) {
         if (sub == null || pre == null || obj == null) {
             return null;
@@ -172,8 +189,10 @@ public class Any23ValueFactoryWrapper implements ValueFactory {
         return wrappedFactory.createStatement(sub, pre, obj);
     }
 
+    @Override
     public Statement createStatement(Resource sub, IRI pre, Value obj, Resource context) {
-        if (sub == null || pre == null || obj == null) return null;
+        if (sub == null || pre == null || obj == null)
+            return null;
         return wrappedFactory.createStatement(sub, pre, obj, context);
     }
 
@@ -181,8 +200,10 @@ public class Any23ValueFactoryWrapper implements ValueFactory {
      * @param uriStr input string to create URI from.
      * @return a valid sesame IRI or null if any exception occurred
      */
+    @Override
     public IRI createIRI(String uriStr) {
-        if (uriStr == null) return null;
+        if (uriStr == null)
+            return null;
         try {
             return wrappedFactory.createIRI(RDFUtils.fixIRIWithException(uriStr));
         } catch (Exception e) {
@@ -194,8 +215,10 @@ public class Any23ValueFactoryWrapper implements ValueFactory {
     /**
      * @return a valid sesame IRI or null if any exception occurred
      */
+    @Override
     public IRI createIRI(String namespace, String localName) {
-        if (namespace == null || localName == null) return null;
+        if (namespace == null || localName == null)
+            return null;
         return wrappedFactory.createIRI(RDFUtils.fixIRIWithException(namespace), localName);
     }
 
@@ -235,9 +258,11 @@ public class Any23ValueFactoryWrapper implements ValueFactory {
      * @return a valid sesame IRI or null if any exception occurred
      */
     public IRI fixLink(String link, String defaultSchema) {
-        if (link == null) return null;
+        if (link == null)
+            return null;
         link = fixWhiteSpace(link);
-        if ("".equals(link)) return null;
+        if ("".equals(link))
+            return null;
         if (defaultSchema != null && !link.startsWith(defaultSchema + ":")) {
             link = defaultSchema + ":" + link;
         }

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/rdf/RDFUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/rdf/RDFUtils.java b/core/src/main/java/org/apache/any23/rdf/RDFUtils.java
index b8f143b..aee9e14 100644
--- a/core/src/main/java/org/apache/any23/rdf/RDFUtils.java
+++ b/core/src/main/java/org/apache/any23/rdf/RDFUtils.java
@@ -24,19 +24,19 @@ import org.eclipse.rdf4j.model.IRI;
 import org.eclipse.rdf4j.model.Literal;
 import org.eclipse.rdf4j.model.Resource;
 import org.eclipse.rdf4j.model.Statement;
-import org.eclipse.rdf4j.model.URI;
 import org.eclipse.rdf4j.model.Value;
 import org.eclipse.rdf4j.model.ValueFactory;
 import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
 import org.eclipse.rdf4j.model.vocabulary.RDF;
 import org.eclipse.rdf4j.rio.RDFFormat;
-import org.eclipse.rdf4j.rio.RDFHandlerException;
-import org.eclipse.rdf4j.rio.RDFParseException;
 import org.eclipse.rdf4j.rio.RDFParser;
 import org.eclipse.rdf4j.rio.RDFParserRegistry;
 import org.eclipse.rdf4j.rio.RDFWriter;
 import org.eclipse.rdf4j.rio.Rio;
+import org.eclipse.rdf4j.rio.helpers.BasicParserSettings;
 import org.eclipse.rdf4j.rio.helpers.StatementCollector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.xml.datatype.DatatypeConfigurationException;
 import javax.xml.datatype.DatatypeFactory;
@@ -67,6 +67,10 @@ public class RDFUtils {
 
     private static final ValueFactory valueFactory = SimpleValueFactory.getInstance();
 
+    private static final Logger LOG = LoggerFactory.getLogger(RDFUtils.class);
+
+    private RDFUtils() {}
+
     /**
      * Fixes typical errors in an absolute org.eclipse.rdf4j.model.IRI, such as unescaped spaces.
      *
@@ -177,17 +181,6 @@ public class RDFUtils {
 
     /**
      * Creates a {@link org.eclipse.rdf4j.model.IRI}.
-     * @param uri string representation of the {@link org.eclipse.rdf4j.model.IRI}
-     * @return a valid {@link org.eclipse.rdf4j.model.IRI}
-     * @deprecated Use {@link #iri(String)} instead.
-     */
-    @Deprecated
-    public static org.eclipse.rdf4j.model.IRI uri(String uri) {
-        return iri(uri);
-    }
-
-    /**
-     * Creates a {@link org.eclipse.rdf4j.model.IRI}.
      * @param iri a base string for the {@link org.eclipse.rdf4j.model.IRI}
      * @return a valid {@link org.eclipse.rdf4j.model.IRI}
      */
@@ -197,18 +190,6 @@ public class RDFUtils {
 
     /**
      * Creates a {@link org.eclipse.rdf4j.model.IRI}.
-     * @deprecated Use {@link #iri(String, String)} instead.
-     * @param namespace a base namespace for the {@link org.eclipse.rdf4j.model.IRI}
-     * @param localName a local name to associate with the namespace
-     * @return a valid {@link org.eclipse.rdf4j.model.IRI}
-     */
-    @Deprecated
-    public static org.eclipse.rdf4j.model.IRI uri(String namespace, String localName) {
-        return valueFactory.createIRI(namespace, localName);
-    }
-
-    /**
-     * Creates a {@link org.eclipse.rdf4j.model.IRI}.
      * @param namespace a base namespace for the {@link org.eclipse.rdf4j.model.IRI}
      * @param localName a local name to associate with the namespace
      * @return a valid {@link org.eclipse.rdf4j.model.IRI}
@@ -297,25 +278,12 @@ public class RDFUtils {
      * @return valid {@link org.eclipse.rdf4j.model.Literal}
      */
     public static Literal literal(String s, String l) {
-    	if(l == null) {
-    		// HACK: Workaround for ANY23 code that passes null in for language tag
-    		return valueFactory.createLiteral(s);
-    	} else {
-    		return valueFactory.createLiteral(s, l);
-    	}
-    }
-
-    /**
-     * Creates a {@link Literal}.
-     * @param s string representation of the base namespace for the
-     * {@link org.eclipse.rdf4j.model.Literal}
-     * @param datatype the datatype to associate with the namespace.
-     * @return valid {@link org.eclipse.rdf4j.model.Literal}
-     * @deprecated Use {@link #literal(String, org.eclipse.rdf4j.model.IRI)} instead.
-     */
-    @Deprecated
-    public static Literal literal(String s, URI datatype) {
-        return valueFactory.createLiteral(s, datatype);
+        if(l == null) {
+            // HACK: Workaround for ANY23 code that passes null in for language tag
+            return valueFactory.createLiteral(s);
+        } else {
+            return valueFactory.createLiteral(s, l);
+        }
     }
 
     /**
@@ -488,15 +456,13 @@ public class RDFUtils {
      * @param is input stream containing <code>RDF</code>.
      * @param baseIRI base uri.
      * @return list of statements detected within the input stream.
-     * @throws RDFHandlerException if there is an error handling the RDF
      * @throws IOException if there is an error reading the {@link java.io.InputStream}
-     * @throws RDFParseException if there is an error handling the RDF
      */
     public static Statement[] parseRDF(RDFFormat format, InputStream is, String baseIRI)
-    throws RDFHandlerException, IOException, RDFParseException {
+    throws IOException {
         final StatementCollector handler = new StatementCollector();
         final RDFParser parser = getParser(format);
-        parser.setVerifyData(true);
+        parser.getParserConfig().set(BasicParserSettings.VERIFY_DATATYPE_VALUES, true);
         parser.setStopAtFirstError(true);
         parser.setPreserveBNodeIDs(true);
         parser.setRDFHandler(handler);
@@ -511,12 +477,10 @@ public class RDFUtils {
      * @param format input format type.
      * @param is input stream containing <code>RDF</code>.
      * @return list of statements detected within the input stream.
-     * @throws RDFHandlerException if there is an error handling the RDF
      * @throws IOException if there is an error reading the {@link java.io.InputStream}
-     * @throws RDFParseException if there is an error handling the RDF
      */
     public static Statement[] parseRDF(RDFFormat format, InputStream is)
-    throws RDFHandlerException, IOException, RDFParseException {
+    throws IOException {
         return parseRDF(format, is, "");
     }
 
@@ -527,12 +491,10 @@ public class RDFUtils {
      * @param format input format type.
      * @param in input string containing <code>RDF</code>.
      * @return list of statements detected within the input string.
-     * @throws RDFHandlerException if there is an error handling the RDF
      * @throws IOException if there is an error reading the {@link java.io.InputStream}
-     * @throws RDFParseException if there is an error handling the RDF
      */
     public static Statement[] parseRDF(RDFFormat format, String in)
-    throws RDFHandlerException, IOException, RDFParseException {
+    throws IOException {
         return parseRDF(format, new ByteArrayInputStream(in.getBytes()));
     }
 
@@ -543,11 +505,9 @@ public class RDFUtils {
      * @param resource resource name.
      * @return the statements declared within the resource file.
      * @throws java.io.IOException if an error occurs while reading file.
-     * @throws org.eclipse.rdf4j.rio.RDFHandlerException if an error occurs while parsing file.
-     * @throws org.eclipse.rdf4j.rio.RDFParseException if an error occurs while parsing file.
      */
-    public static Statement[] parseRDF(String resource) throws RDFHandlerException, IOException, RDFParseException {
-        final int extIndex = resource.lastIndexOf(".");
+    public static Statement[] parseRDF(String resource) throws IOException {
+        final int extIndex = resource.lastIndexOf('.');
         if(extIndex == -1)
             throw new IllegalArgumentException("Error while detecting the extension in resource name " + resource);
         final String extension = resource.substring(extIndex + 1);
@@ -568,8 +528,10 @@ public class RDFUtils {
             new java.net.URI(href.trim());
             return true;
         } catch (IllegalArgumentException e) {
+            LOG.error("Error processing href: {}", href, e);
             return false;
         } catch (URISyntaxException e) {
+            LOG.error("Error interpreting href: {} as URI.", href, e);
             return false;
         }
     }
@@ -649,7 +611,5 @@ public class RDFUtils {
         nodeId++;
         return bnode;
     }
-    
-    private RDFUtils() {}
 
 }

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/validator/XMLValidationReportSerializer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/validator/XMLValidationReportSerializer.java b/core/src/main/java/org/apache/any23/validator/XMLValidationReportSerializer.java
index 648db28..2e591d0 100644
--- a/core/src/main/java/org/apache/any23/validator/XMLValidationReportSerializer.java
+++ b/core/src/main/java/org/apache/any23/validator/XMLValidationReportSerializer.java
@@ -41,6 +41,7 @@ import java.util.List;
  */
 public class XMLValidationReportSerializer implements ValidationReportSerializer {
 
+    @Override
     public void serialize(ValidationReport vr, OutputStream os) throws SerializationException {
         final PrintStream ps = new PrintStream(os);
         try {
@@ -54,9 +55,9 @@ public class XMLValidationReportSerializer implements ValidationReportSerializer
         if(o == null) {
             return;
         }
-        final Class oClass = o.getClass();
+        final Class<? extends Object> oClass = o.getClass();
         final String oClassName = getClassName(oClass);
-        ps.printf("<%s>\n", oClassName);
+        ps.printf("<%s>%n", oClassName);
         List<Method> getters = filterGetters(o.getClass());
         if(getters.isEmpty()) {
             ps.print( o.toString() );
@@ -65,11 +66,11 @@ public class XMLValidationReportSerializer implements ValidationReportSerializer
         for (Method getter : getters) {
             serializeGetterValue(o, getter, ps);
         }
-        ps.printf("</%s>\n", oClassName);
+        ps.printf("</%s>%n", oClassName);
     }
 
-    private String getClassName(Class oClass) {
-        final NodeName nodeName = (NodeName) oClass.getAnnotation(NodeName.class);
+    private String getClassName(Class<? extends Object> oClass) {
+        final NodeName nodeName = oClass.getAnnotation(NodeName.class);
         if(nodeName != null) {
             return nodeName.value();
         }
@@ -77,9 +78,9 @@ public class XMLValidationReportSerializer implements ValidationReportSerializer
         return Character.toLowerCase(simpleName.charAt(0)) + simpleName.substring(1);
     }
 
-    private List<Method> filterGetters(Class c) {
+    private List<Method> filterGetters(Class<? extends Object> c) {
         Method[] methods = c.getDeclaredMethods();
-        List<Method> filtered = new ArrayList<Method>();
+        List<Method> filtered = new ArrayList<>();
         for(Method method : methods) {
             if(Modifier.isStatic(method.getModifiers())) {
                 continue;
@@ -110,9 +111,9 @@ public class XMLValidationReportSerializer implements ValidationReportSerializer
         }
         final String property = getPropertyFromMethodName(methodName);
         if( isManaged(value) ) {
-            ps.printf("<%s>\n", property);
+            ps.printf("<%s>%n", property);
             printObject(value, ps);
-            ps.printf("</%s>\n", property);
+            ps.printf("</%s>%n", property);
         } else {
             List<Method> getters = filterGetters(value.getClass());
             for (Method getter : getters) {
@@ -148,7 +149,7 @@ public class XMLValidationReportSerializer implements ValidationReportSerializer
             return;
         }
         if(o instanceof Collection) {
-            Collection collection = (Collection) o;
+            Collection<?> collection = (Collection<?>) o;
             if(collection.isEmpty()) {
                 return;
             }

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/validator/rule/AboutNotURIRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/validator/rule/AboutNotURIRule.java b/core/src/main/java/org/apache/any23/validator/rule/AboutNotURIRule.java
index 0275c4e..cb3e668 100644
--- a/core/src/main/java/org/apache/any23/validator/rule/AboutNotURIRule.java
+++ b/core/src/main/java/org/apache/any23/validator/rule/AboutNotURIRule.java
@@ -45,6 +45,7 @@ public class AboutNotURIRule implements Rule {
         return "about-not-uri-rule";
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public boolean applyOn(
             DOMDocument document,

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/validator/rule/MetaNameMisuseRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/validator/rule/MetaNameMisuseRule.java b/core/src/main/java/org/apache/any23/validator/rule/MetaNameMisuseRule.java
index 1b965ec..757b6de 100644
--- a/core/src/main/java/org/apache/any23/validator/rule/MetaNameMisuseRule.java
+++ b/core/src/main/java/org/apache/any23/validator/rule/MetaNameMisuseRule.java
@@ -43,6 +43,7 @@ public class MetaNameMisuseRule implements Rule {
         return "meta-name-misuse-rule";
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public boolean applyOn(
             DOMDocument document,

http://git-wip-us.apache.org/repos/asf/any23/blob/60e93a76/core/src/main/java/org/apache/any23/vocab/RDFSchemaUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/any23/vocab/RDFSchemaUtils.java b/core/src/main/java/org/apache/any23/vocab/RDFSchemaUtils.java
index 70d241a..f678913 100644
--- a/core/src/main/java/org/apache/any23/vocab/RDFSchemaUtils.java
+++ b/core/src/main/java/org/apache/any23/vocab/RDFSchemaUtils.java
@@ -43,7 +43,9 @@ import java.util.Map;
 public class RDFSchemaUtils {
 
     private static final String RDF_XML_SEPARATOR = StringUtils.multiply('=', 100);
-    
+
+    private RDFSchemaUtils() {}
+
     /**
      * Serializes a vocabulary composed of the given <code>namespace</code>,
      * <code>resources</code> and <code>properties</code>.
@@ -61,7 +63,7 @@ public class RDFSchemaUtils {
             IRI[] properties,
             Map<IRI,String> comments,
             RDFWriter writer
-    ) throws RDFHandlerException {
+    ) {
         writer.startRDF();
         for(IRI clazz : classes) {
             writer.handleStatement( RDFUtils.quad(clazz, RDF.TYPE, RDFS.CLASS, namespace) );
@@ -87,8 +89,7 @@ public class RDFSchemaUtils {
      * @param writer output writer.
      * @throws RDFHandlerException if there is an error handling the RDF
      */
-    public static void serializeVocabulary(Vocabulary vocabulary, RDFWriter writer)
-    throws RDFHandlerException {
+    public static void serializeVocabulary(Vocabulary vocabulary, RDFWriter writer) {
         serializeVocabulary(
                 vocabulary.getNamespace(),
                 vocabulary.getClasses(),
@@ -111,8 +112,7 @@ public class RDFSchemaUtils {
             Vocabulary vocabulary,
             RDFFormat format,
             boolean willFollowAnother,
-            PrintStream ps
-    ) throws RDFHandlerException {
+            PrintStream ps) {
         final RDFWriter rdfWriter;
         if(format == RDFFormat.RDFXML) {
             rdfWriter = Rio.createWriter(RDFFormat.RDFXML, ps);
@@ -134,8 +134,7 @@ public class RDFSchemaUtils {
      * @return string contained serialization.
      * @throws RDFHandlerException if there is an error handling the RDF
      */
-    public static String serializeVocabulary(Vocabulary vocabulary, RDFFormat format)
-    throws RDFHandlerException {
+    public static String serializeVocabulary(Vocabulary vocabulary, RDFFormat format) {
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
         final PrintStream ps = new PrintStream(baos);
         serializeVocabulary(vocabulary, format, false, ps);
@@ -150,16 +149,17 @@ public class RDFSchemaUtils {
      * @param ps output print stream.
      */
     public static void serializeVocabularies(RDFFormat format, PrintStream ps) {
-        final Class vocabularyClass = Vocabulary.class;
+        final Class<Vocabulary> vocabularyClass = Vocabulary.class;
+        @SuppressWarnings("rawtypes")
         final List<Class> vocabularies = DiscoveryUtils.getClassesInPackage(
                 vocabularyClass.getPackage().getName(),
                 vocabularyClass
         );
         int currentIndex = 0;
-        for (Class vocabClazz : vocabularies) {
+        for (Class<?> vocabClazz : vocabularies) {
             final Vocabulary instance;
             try {
-                final Constructor constructor = vocabClazz.getDeclaredConstructor();
+                final Constructor<?> constructor = vocabClazz.getDeclaredConstructor();
                 constructor.setAccessible(true);
                 instance = (Vocabulary) constructor.newInstance();
             } catch (Exception e) {
@@ -173,6 +173,4 @@ public class RDFSchemaUtils {
         }
     }
 
-    private RDFSchemaUtils() {}
-
 }