You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@any23.apache.org by ha...@apache.org on 2018/10/30 15:25:54 UTC

any23 git commit: Require strict isomorphism in all microdata tests. Revert microdata 5.2.1.2-expected.nquads back to original version from before the v2.2 microdata regression.

Repository: any23
Updated Branches:
  refs/heads/master 2175c2d37 -> 0270bb0cf


Require strict isomorphism in all microdata tests. Revert microdata 5.2.1.2-expected.nquads back to original version from before the v2.2 microdata regression.


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

Branch: refs/heads/master
Commit: 0270bb0cf5f42ace91e7efe8c0d6717b46a0bc48
Parents: 2175c2d
Author: Hans <fi...@gmail.com>
Authored: Tue Oct 30 10:25:26 2018 -0500
Committer: Hans <fi...@gmail.com>
Committed: Tue Oct 30 10:25:26 2018 -0500

----------------------------------------------------------------------
 .../microdata/MicrodataExtractorTest.java       | 40 ++++++++++++++++----
 ....2.1-non-normative-example-2-expected.nquads | 26 ++++++-------
 2 files changed, 45 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/any23/blob/0270bb0c/core/src/test/java/org/apache/any23/extractor/microdata/MicrodataExtractorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/any23/extractor/microdata/MicrodataExtractorTest.java b/core/src/test/java/org/apache/any23/extractor/microdata/MicrodataExtractorTest.java
index 0e634de..01a0585 100644
--- a/core/src/test/java/org/apache/any23/extractor/microdata/MicrodataExtractorTest.java
+++ b/core/src/test/java/org/apache/any23/extractor/microdata/MicrodataExtractorTest.java
@@ -29,9 +29,9 @@ import org.apache.any23.extractor.rdf.TurtleExtractorFactory;
 import org.apache.any23.rdf.RDFUtils;
 import org.apache.any23.source.DocumentSource;
 import org.apache.any23.source.HTTPDocumentSource;
-import org.apache.any23.vocab.SINDICE;
 import org.apache.any23.writer.TripleWriterHandler;
 import org.eclipse.rdf4j.model.IRI;
+import org.eclipse.rdf4j.model.Model;
 import org.eclipse.rdf4j.model.Value;
 import org.eclipse.rdf4j.model.Literal;
 import org.eclipse.rdf4j.model.Resource;
@@ -428,14 +428,38 @@ public class MicrodataExtractorTest extends AbstractExtractorTestCase {
         int actualStmtSize = getStatementsSize(null, null, null);
         Assert.assertEquals( expectedStatements.size(), actualStmtSize);
         for (Statement statement : expectedStatements) {
-            if (!statement.getPredicate().equals(SINDICE.getInstance().date)) {
-                assertContains(
-                        statement.getSubject() instanceof BNode ? null : statement.getSubject(),
-                        statement.getPredicate(),
-                        statement.getObject() instanceof BNode ? null : statement.getObject()
-                );
-            }
+            assertContains(
+                    statement.getSubject() instanceof BNode ? null : statement.getSubject(),
+                    statement.getPredicate(),
+                    statement.getObject() instanceof BNode ? null : statement.getObject()
+            );
+        }
+        Model expectedModel = new TreeModel();
+        for (Statement s : expectedStatements) {
+            expectedModel.add(s.getSubject(), s.getPredicate(), s.getObject());
         }
+
+        Model actualModel = new TreeModel();
+        conn.export(new RDFHandler() {
+            @Override
+            public void startRDF() throws RDFHandlerException {
+            }
+            @Override
+            public void endRDF() throws RDFHandlerException {
+            }
+            @Override
+            public void handleNamespace(String s, String s1) throws RDFHandlerException {
+            }
+            @Override
+            public void handleStatement(Statement statement) throws RDFHandlerException {
+                actualModel.add(statement.getSubject(), statement.getPredicate(), statement.getObject());
+            }
+            @Override
+            public void handleComment(String s) throws RDFHandlerException {
+            }
+        });
+
+        Assert.assertTrue("Models are not isomorphic", Models.isomorphic(expectedModel, actualModel));
     }
 
     private List<Statement> loadResultStatement(String resultFilePath)

http://git-wip-us.apache.org/repos/asf/any23/blob/0270bb0c/test-resources/src/test/resources/microdata/5.2.1-non-normative-example-2-expected.nquads
----------------------------------------------------------------------
diff --git a/test-resources/src/test/resources/microdata/5.2.1-non-normative-example-2-expected.nquads b/test-resources/src/test/resources/microdata/5.2.1-non-normative-example-2-expected.nquads
index 8eedf33..a76ac84 100644
--- a/test-resources/src/test/resources/microdata/5.2.1-non-normative-example-2-expected.nquads
+++ b/test-resources/src/test/resources/microdata/5.2.1-non-normative-example-2-expected.nquads
@@ -15,16 +15,16 @@
 #  limitations under the License.
 #
 
-_:nodebdb2c525cf8095abb6954b51432e6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://microformats.org/profile/hcard> <http://bob.example.com/> .
-_:nodebdb2c525cf8095abb6954b51432e6 <http://microformats.org/profile/hcard#fn> "Princeton" <http://bob.example.com/> .
-_:nodebdb2c525cf8095abb6954b51432e6 <http://microformats.org/profile/hcard#given-name> "Princeton" <http://bob.example.com/> .
-_:nodebdb2c525cf8095abb6954b51432e6 <http://microformats.org/profile/hcard#n> _:node5194c3bb9d7f53e4759c6f393d95f88 <http://bob.example.com/> .
-_:node1ffeb2699b75ba7aca5ee3d72adb55a8 <http://microformats.org/profile/hcard#street-address> "Avenue Q" <http://bob.example.com/> .
-_:nodebdb2c525cf8095abb6954b51432e6 <http://microformats.org/profile/hcard#adr> _:node1ffeb2699b75ba7aca5ee3d72adb55a8 <http://bob.example.com/> .
-<http://bob.example.com/> <http://www.w3.org/1999/xhtml/microdata#item> _:nodebdb2c525cf8095abb6954b51432e6 <http://bob.example.com/> .
-_:node7a12e48e321d29211c8b7c2ce396854 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://microformats.org/profile/hcard> <http://bob.example.com/> .
-_:node7a12e48e321d29211c8b7c2ce396854 <http://microformats.org/profile/hcard#fn> "Trekkie" <http://bob.example.com/> .
-_:node7a12e48e321d29211c8b7c2ce396854 <http://microformats.org/profile/hcard#given-name> "Trekkie" <http://bob.example.com/> .
-_:node7a12e48e321d29211c8b7c2ce396854 <http://microformats.org/profile/hcard#n> _:node45173ea18b736c2e9c3136e52ed3727e <http://bob.example.com/> .
-_:node7a12e48e321d29211c8b7c2ce396854 <http://microformats.org/profile/hcard#adr> _:node1ffeb2699b75ba7aca5ee3d72adb55a8 <http://bob.example.com/> .
-<http://bob.example.com/> <http://www.w3.org/1999/xhtml/microdata#item> _:node7a12e48e321d29211c8b7c2ce396854 <http://bob.example.com/> .
+<http://bob.example.com/> <http://www.w3.org/1999/xhtml/microdata#item> _:node161nd8236x293102 <http://bob.example.com/> .
+<http://bob.example.com/> <http://www.w3.org/1999/xhtml/microdata#item> _:node161nd8236x293103 <http://bob.example.com/> .
+_:node161nd8236x293102 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://microformats.org/profile/hcard> <http://bob.example.com/> .
+_:node161nd8236x293102 <http://microformats.org/profile/hcard#fn> "Princeton" <http://bob.example.com/> .
+_:node161nd8236x293102 <http://microformats.org/profile/hcard#n> _:node161nd8236x293104 <http://bob.example.com/> .
+_:node161nd8236x293102 <http://microformats.org/profile/hcard#adr> _:node161nd8236x293105 <http://bob.example.com/> .
+_:node161nd8236x293104 <http://microformats.org/profile/hcard#given-name> "Princeton" <http://bob.example.com/> .
+_:node161nd8236x293103 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://microformats.org/profile/hcard> <http://bob.example.com/> .
+_:node161nd8236x293103 <http://microformats.org/profile/hcard#fn> "Trekkie" <http://bob.example.com/> .
+_:node161nd8236x293103 <http://microformats.org/profile/hcard#n> _:node161nd8236x293106 <http://bob.example.com/> .
+_:node161nd8236x293103 <http://microformats.org/profile/hcard#adr> _:node161nd8236x293105 <http://bob.example.com/> .
+_:node161nd8236x293106 <http://microformats.org/profile/hcard#given-name> "Trekkie" <http://bob.example.com/> .
+_:node161nd8236x293105 <http://microformats.org/profile/hcard#street-address> "Avenue Q" <http://bob.example.com/> .