diff --git a/sparql-anything-html/src/test/java/io/github/sparqlanything/html/RDFaSandbox.java b/sparql-anything-html/src/test/java/io/github/sparqlanything/html/RDFaSandbox.java deleted file mode 100644 index 9cfa8a2c..00000000 --- a/sparql-anything-html/src/test/java/io/github/sparqlanything/html/RDFaSandbox.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2024 SPARQL Anything Contributors @ http://github.com/sparql-anything - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.github.sparqlanything.html; - -import io.github.sparqlanything.html.org.semarglproject.rdf.ParseException; -import io.github.sparqlanything.html.org.semarglproject.rdf.rdfa.RdfaParser; -import io.github.sparqlanything.html.org.semarglproject.sink.TripleSink; -import io.github.sparqlanything.html.org.semarglproject.source.StreamProcessor; -import org.apache.jena.rdf.model.Model; -import org.apache.jena.rdf.model.ModelFactory; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; - -public class RDFaSandbox { - private static final Logger logger = LoggerFactory.getLogger(TestRDFaParser.class); - @Test - public void RDFa() throws ParseException { - - TripleSink ts = new TripleSink() { - @Override - public void addNonLiteral(String subj, String pred, String obj) { - logger.trace("add non literal {} {} {}", subj, pred, obj); - } - - @Override - public void addPlainLiteral(String subj, String pred, String content, String lang) { - logger.trace("addPlainLiteral {} {} {} {}", subj, pred, content, lang); - } - - @Override - public void addTypedLiteral(String subj, String pred, String content, String type) { - logger.trace("addTypedLiteral {} {} {} {}", subj, pred, content, type); - } - - @Override - public void setBaseUri(String baseUri) { - logger.trace("setBaseURI {}", baseUri); - - } - - @Override - public void startStream() throws ParseException { - logger.trace("start stream"); - } - - @Override - public void endStream() throws ParseException { - logger.trace("end stream"); - } - - @Override - public boolean setProperty(String key, Object value) { - logger.trace("set property {} {}", key,value); - return false; - } - }; - - logger.trace("test logger"); - - StreamProcessor streamProcessor = new StreamProcessor(RdfaParser.connect(ts)); - streamProcessor.process(new File("/Users/lgu/workspace/SPARQLAnything/sparql.anything/sparql-anything-html/src/test/resources/RDFa.html")); - } -} diff --git a/sparql-anything-html/src/test/java/io/github/sparqlanything/html/TestRDFaParser.java b/sparql-anything-html/src/test/java/io/github/sparqlanything/html/RDFaTest.java similarity index 92% rename from sparql-anything-html/src/test/java/io/github/sparqlanything/html/TestRDFaParser.java rename to sparql-anything-html/src/test/java/io/github/sparqlanything/html/RDFaTest.java index 3ff7a270..bf3cc5e3 100644 --- a/sparql-anything-html/src/test/java/io/github/sparqlanything/html/TestRDFaParser.java +++ b/sparql-anything-html/src/test/java/io/github/sparqlanything/html/RDFaTest.java @@ -23,14 +23,13 @@ import java.util.Properties; -public class TestRDFaParser extends AbstractTriplifierTester { +public class RDFaTest extends AbstractTriplifierTester { - public TestRDFaParser() { + public RDFaTest() { super(new HTMLTriplifier(), new Properties(), "html", "nq"); this.printWholeGraph = true; } - @Ignore @Test public void testRDFa() { this.assertResultIsIsomorphicWithExpected(); diff --git a/sparql-anything-html/src/test/resources/RDFa.nq b/sparql-anything-html/src/test/resources/RDFa.nq index 07288c54..5c9b9285 100644 --- a/sparql-anything-html/src/test/resources/RDFa.nq +++ b/sparql-anything-html/src/test/resources/RDFa.nq @@ -1,60 +1,95 @@ - "Director: James Cameron (born August 16, 1954)" . - "Director: James Cameron (born August 16, 1954)" . - . - "Director: James Cameron (born August 16, 1954)" . - "

Avatar

Director: James Cameron (born August 16, 1954)" . - "Avatar Director: James Cameron (born August 16, 1954)" . + . + . + "Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332" . + . + "
\n

Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332

\n
" . + "Person" . . - "" . - "https://schema.org/Movie" . - . - . + "Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332" . + . + "

Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332

" . + "http://xmlns.com/foaf/0.1/" . . - "\n\n
\n

Avatar

Director: James Cameron (born August 16, 1954)\n
\n" . - "Avatar Director: James Cameron (born August 16, 1954)" . . - . . -_:Bnode1hn5vtssbx2 . -_:Bnode1hn5vtssbx2 "Avatar" . - "Avatar" . - "Avatar" . - . - "name" . - "Avatar" . - . - _:Bnode1hn5vtssbx2 . - "
\n

Avatar

Director: James Cameron (born August 16, 1954)\n
" . - "Avatar Director: James Cameron (born August 16, 1954)" . - . - . - "Director: James Cameron (born August 16, 1954)" . - . - "Director: James Cameron (born August 16, 1954)" . - "Director: James Cameron (born August 16, 1954)" . - . - . - "https://schema.org/Movie" . - "" . + "Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332" . + . + "\n\n
\n

Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332

\n
\n" . + . + "name" . + "Alice Birpemswick" . + "Alice Birpemswick" . + "Alice Birpemswick" . + . + ", Email: " . + . + "Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332" . + . + "Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332" . + ", Phone: " . + . + . + "mbox" . + "alice@example.com" . + "alice@example.com" . + "alice@example.com" . + "mailto:alice@example.com" . + . + "phone" . + "+1 617.555.7332" . + "+1 617.555.7332" . + "+1 617.555.7332" . + "tel:+1-617-555-7332" . + . +_:Bedd7d40151074328111a4249b727f22a . +_:Bedd7d40151074328111a4249b727f22a . +_:Bedd7d40151074328111a4249b727f22a . +_:Bedd7d40151074328111a4249b727f22a "Alice Birpemswick" . + . + . + "Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332" . + . + "
\n

Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332

\n
" . + "Person" . . - "Avatar Director: James Cameron (born August 16, 1954)" . - "

Avatar

Director: James Cameron (born August 16, 1954)" . + "Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332" . + . + "

Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332

" . + "http://xmlns.com/foaf/0.1/" . + . + . . + "Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332" . . - . - "Avatar Director: James Cameron (born August 16, 1954)" . - "\n\n
\n

Avatar

Director: James Cameron (born August 16, 1954)\n
\n" . - . -_:Bnode1hn5vtssbx2 "Avatar" . -_:Bnode1hn5vtssbx2 . - "Avatar" . - "name" . - . - "Avatar" . - "Avatar" . - _:Bnode1hn5vtssbx2 . - . - . - . - "Avatar Director: James Cameron (born August 16, 1954)" . - "
\n

Avatar

Director: James Cameron (born August 16, 1954)\n
" . + "\n\n
\n

Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332

\n
\n" . + . + "name" . + "Alice Birpemswick" . + "Alice Birpemswick" . + "Alice Birpemswick" . + . + ", Email: " . + . + "Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332" . + . + "Alice Birpemswick, Email: alice@example.com, Phone: +1 617.555.7332" . + ", Phone: " . + . + . + "mbox" . + "alice@example.com" . + "alice@example.com" . + "alice@example.com" . + "mailto:alice@example.com" . + . + "phone" . + "+1 617.555.7332" . + "+1 617.555.7332" . + "+1 617.555.7332" . + "tel:+1-617-555-7332" . + . +_:Bedd7d40151074328111a4249b727f22a . +_:Bedd7d40151074328111a4249b727f22a . +_:Bedd7d40151074328111a4249b727f22a . +_:Bedd7d40151074328111a4249b727f22a "Alice Birpemswick" . +