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 2014/05/09 03:59:57 UTC
[5/9] git commit: fix invalid RDFa tests
fix invalid RDFa tests
Project: http://git-wip-us.apache.org/repos/asf/any23/repo
Commit: http://git-wip-us.apache.org/repos/asf/any23/commit/2af8c0a3
Tree: http://git-wip-us.apache.org/repos/asf/any23/tree/2af8c0a3
Diff: http://git-wip-us.apache.org/repos/asf/any23/diff/2af8c0a3
Branch: refs/heads/master
Commit: 2af8c0a3f97b4cb2ce19b76726cb916365462b25
Parents: ea67727
Author: levkhomich <le...@gmail.com>
Authored: Sat Mar 1 21:22:07 2014 +0600
Committer: levkhomich <le...@gmail.com>
Committed: Sat Mar 1 21:22:07 2014 +0600
----------------------------------------------------------------------
.../html/AbstractExtractorTestCase.java | 2 +-
.../extractor/rdfa/RDFa11ExtractorTest.java | 33 +++++++++++---------
.../html/rdfa/goodrelations-rdfa10-expected.nq | 2 --
.../html/rdfa/goodrelations-rdfa11.html | 4 +--
.../src/test/resources/html/rdfa/rel-rev.html | 2 +-
5 files changed, 23 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/any23/blob/2af8c0a3/core/src/test/java/org/apache/any23/extractor/html/AbstractExtractorTestCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/any23/extractor/html/AbstractExtractorTestCase.java b/core/src/test/java/org/apache/any23/extractor/html/AbstractExtractorTestCase.java
index 1ec89c3..6384ab4 100644
--- a/core/src/test/java/org/apache/any23/extractor/html/AbstractExtractorTestCase.java
+++ b/core/src/test/java/org/apache/any23/extractor/html/AbstractExtractorTestCase.java
@@ -68,7 +68,7 @@ public abstract class AbstractExtractorTestCase extends AbstractAny23TestBase {
/**
* Internal connection used to collect extraction results.
*/
- private RepositoryConnection conn;
+ protected RepositoryConnection conn;
/**
* The latest generated report.
http://git-wip-us.apache.org/repos/asf/any23/blob/2af8c0a3/core/src/test/java/org/apache/any23/extractor/rdfa/RDFa11ExtractorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/any23/extractor/rdfa/RDFa11ExtractorTest.java b/core/src/test/java/org/apache/any23/extractor/rdfa/RDFa11ExtractorTest.java
index 50e8d26..a9984de 100644
--- a/core/src/test/java/org/apache/any23/extractor/rdfa/RDFa11ExtractorTest.java
+++ b/core/src/test/java/org/apache/any23/extractor/rdfa/RDFa11ExtractorTest.java
@@ -17,7 +17,6 @@
package org.apache.any23.extractor.rdfa;
-import org.apache.any23.extractor.IssueReport;
import org.apache.any23.extractor.ExtractionException;
import org.apache.any23.extractor.ExtractorFactory;
import org.apache.any23.rdf.RDFUtils;
@@ -26,8 +25,11 @@ import org.apache.any23.vocab.OGP;
import org.junit.Assert;
import org.junit.Test;
import org.openrdf.model.Literal;
+import org.openrdf.model.Statement;
+import org.openrdf.model.Value;
import org.openrdf.model.vocabulary.RDF;
import org.openrdf.repository.RepositoryException;
+import org.openrdf.repository.RepositoryResult;
import org.openrdf.rio.RDFHandlerException;
import org.openrdf.rio.RDFParseException;
@@ -70,15 +72,19 @@ public class RDFa11ExtractorTest extends AbstractRDFaExtractorTestCase {
assertExtract("/html/rdfa/xmlliteral-datatype-test.html");
logger.debug(dumpModelToTurtle());
- Literal literal = RDFUtils.literal(
- "<SPAN datatype=\"rdf:XMLLiteral\" property=\"foaf:name\">Albert <STRONG>Einstein</STRONG></SPAN>",
- RDF.XMLLITERAL
- );
- assertContains(
- RDFUtils.uri("http://dbpedia.org/resource/Albert_Einstein"),
- vFOAF.name,
- literal
- );
+ RepositoryResult<Statement> stmts =
+ conn.getStatements(RDFUtils.uri("http://dbpedia.org/resource/Albert_Einstein"),
+ vFOAF.name, null, false);
+ Assert.assertTrue(stmts.hasNext());
+ Value obj = stmts.next().getObject();
+ Assert.assertTrue(obj instanceof Literal);
+ Literal lit = (Literal) obj;
+ Assert.assertEquals(lit.getDatatype(), RDF.XMLLITERAL);
+ Assert.assertEquals(lit.getLabel(), "Albert <strong xmlns=\"http://www.w3.org/1999/xhtml\" " +
+ "xmlns:foaf=\"http://xmlns.com/foaf/0.1/\" " +
+ "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" " +
+ "xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" " +
+ "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\">Einstein</strong>");
}
/**
@@ -151,9 +157,8 @@ public class RDFa11ExtractorTest extends AbstractRDFaExtractorTestCase {
* Tests that the default parser settings enable tolerance in data type parsing.
*/
@Test
- public void testTolerantParsing() {
+ public void testTolerantParsing() throws RepositoryException {
assertExtract("/html/rdfa/oreilly-invalid-datatype.html", false);
- assertIssue(IssueReport.IssueLevel.Warning, ".*Cannot map prefix \'mailto\'.*");
}
/**
@@ -168,7 +173,7 @@ public class RDFa11ExtractorTest extends AbstractRDFaExtractorTestCase {
@Test
public void testRDFa10Extraction()
throws RepositoryException, RDFHandlerException, IOException, RDFParseException {
- final int EXPECTED_STATEMENTS = 33;
+ final int EXPECTED_STATEMENTS = 31;
assertExtract("/html/rdfa/goodrelations-rdfa10.html");
logger.debug(dumpModelToNQuads());
@@ -189,7 +194,7 @@ public class RDFa11ExtractorTest extends AbstractRDFaExtractorTestCase {
@Test
public void testRDFa11Extraction()
throws RepositoryException, RDFHandlerException, IOException, RDFParseException {
- final int EXPECTED_STATEMENTS = 33;
+ final int EXPECTED_STATEMENTS = 31;
assertExtract("/html/rdfa/goodrelations-rdfa11.html");
logger.debug(dumpHumanReadableTriples());
http://git-wip-us.apache.org/repos/asf/any23/blob/2af8c0a3/test-resources/src/test/resources/html/rdfa/goodrelations-rdfa10-expected.nq
----------------------------------------------------------------------
diff --git a/test-resources/src/test/resources/html/rdfa/goodrelations-rdfa10-expected.nq b/test-resources/src/test/resources/html/rdfa/goodrelations-rdfa10-expected.nq
index a069f9b..eb24cd3 100644
--- a/test-resources/src/test/resources/html/rdfa/goodrelations-rdfa10-expected.nq
+++ b/test-resources/src/test/resources/html/rdfa/goodrelations-rdfa10-expected.nq
@@ -36,7 +36,6 @@ _:node16dssb0gtx2 <http://purl.org/goodrelations/v1#valueAddedTaxIncluded> "true
<http://bob.example.com/#product> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/goodrelations/v1#SomeItems> <http://bob.example.com/> .
<http://bob.example.com/#offer> <http://purl.org/goodrelations/v1#includes> <http://bob.example.com/#product> <http://bob.example.com/> .
_:node16dssb0gtx3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/goodrelations/v1#QuantitativeValue> <http://bob.example.com/> .
-<http://bob.example.com/#offer> <http://purl.org/goodrelations/v1#includes> _:node16dssb0gtx3 <http://bob.example.com/> .
<http://bob.example.com/#product> <http://purl.org/goodrelations/v1#hasInventoryLevel> _:node16dssb0gtx3 <http://bob.example.com/> .
_:node16dssb0gtx3 <http://purl.org/goodrelations/v1#hasMinValue> "1"^^<http://www.w3.org/2001/XMLSchema#float> <http://bob.example.com/> .
<http://bob.example.com/#product> <http://xmlns.com/foaf/0.1/page> <http://bob.example.com/> <http://bob.example.com/> .
@@ -45,6 +44,5 @@ _:node16dssb0gtx3 <http://purl.org/goodrelations/v1#hasMinValue> "1"^^<http://ww
<http://bob.example.com/#product> <http://purl.org/goodrelations/v1#hasEAN_UCC-13> "013803123784"^^<http://www.w3.org/2001/XMLSchema#string> <http://bob.example.com/> .
<http://bob.example.com/#product> <http://purl.org/goodrelations/v1#hasStockKeepingUnit> "10363780"^^<http://www.w3.org/2001/XMLSchema#string> <http://bob.example.com/> .
<http://bob.example.com/#product> <http://purl.org/goodrelations/v1#hasMPN> "EOS550D"^^<http://www.w3.org/2001/XMLSchema#string> <http://bob.example.com/> .
-<http://bob.example.com/#offer> <http://purl.org/goodrelations/v1#includes> <http://www.heppnetz.de/searchmonkey/pscsi.jpg> <http://bob.example.com/> .
<http://bob.example.com/#product> <http://xmlns.com/foaf/0.1/depiction> <http://www.heppnetz.de/searchmonkey/pscsi.jpg> <http://bob.example.com/> .
<http://bob.example.com/#product> <http://purl.org/goodrelations/v1#hasManufacturer> <http://www.google.com/#company> <http://bob.example.com/> .
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/any23/blob/2af8c0a3/test-resources/src/test/resources/html/rdfa/goodrelations-rdfa11.html
----------------------------------------------------------------------
diff --git a/test-resources/src/test/resources/html/rdfa/goodrelations-rdfa11.html b/test-resources/src/test/resources/html/rdfa/goodrelations-rdfa11.html
index 5cef1d6..08a758d 100644
--- a/test-resources/src/test/resources/html/rdfa/goodrelations-rdfa11.html
+++ b/test-resources/src/test/resources/html/rdfa/goodrelations-rdfa11.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0" xml:lang="en"
+<html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.1" xml:lang="en"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
http://git-wip-us.apache.org/repos/asf/any23/blob/2af8c0a3/test-resources/src/test/resources/html/rdfa/rel-rev.html
----------------------------------------------------------------------
diff --git a/test-resources/src/test/resources/html/rdfa/rel-rev.html b/test-resources/src/test/resources/html/rdfa/rel-rev.html
index 0a470c8..735717b 100644
--- a/test-resources/src/test/resources/html/rdfa/rel-rev.html
+++ b/test-resources/src/test/resources/html/rdfa/rel-rev.html
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html xmlns="http://www.w3.org/1999/xhtml" vocab="http://bob.example.com/">
<head></head>
<body>
As Gandalf the White said in