Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions java-rdfa-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>net.rootdev.javardfa</Export-Package>
<Import-Package>com.hp.hpl.jena.iri,!com.hp.hpl.jena.*,!org.mozilla.*,*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
Expand Down
12 changes: 7 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.rootdev</groupId>
<artifactId>java-rdfa</artifactId>
<packaging>jar</packaging>
<packaging>bundle</packaging>
<version>0.4.3-SNAPSHOT</version>
<properties>
<org.apache.jena.version>3.0.1</org.apache.jena.version>
Expand Down Expand Up @@ -60,8 +60,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
Expand Down Expand Up @@ -134,6 +134,7 @@
<link>http://jena.apache.org/documentation/javadoc/arq/</link>
<link>http://www.openrdf.org/doc/sesame2/api/</link>
</links>
<source>1.6</source>
</configuration>
<executions>
<execution>
Expand All @@ -153,11 +154,12 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.1</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>net.rootdev.javardfa</Export-Package>
<Import-Package>org.apache.jena.iri,!org.apache.jena.*,!org.mozilla.*,*</Import-Package>
<Export-Package>net.rootdev.javardfa,net.rootdev.javardfa.*</Export-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
Expand Down
12 changes: 6 additions & 6 deletions sesame-module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,34 +160,34 @@
<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-rio-api</artifactId>
<version>2.2.4</version>
<version>2.8.11</version>
</dependency>
<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-rio-turtle</artifactId>
<version>2.2.4</version>
<version>2.8.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-query</artifactId>
<version>2.2.4</version>
<version>2.8.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-repository-sail</artifactId>
<version>2.2.4</version>
<version>2.8.11</version>
</dependency>
<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-sail-memory</artifactId>
<version>2.2.4</version>
<version>2.8.11</version>
</dependency>
<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-queryparser-sparql</artifactId>
<version>2.2.4</version>
<version>2.8.11</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,22 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.Collection;

import nu.validator.htmlparser.common.XmlViolationPolicy;
import nu.validator.htmlparser.sax.HtmlParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.openrdf.model.ValueFactory;
import org.openrdf.rio.ParseErrorListener;
import org.openrdf.rio.ParseLocationListener;
import org.openrdf.rio.ParserConfig;
import org.openrdf.rio.RDFFormat;
import org.openrdf.rio.RDFHandler;
import org.openrdf.rio.RDFHandlerException;
import org.openrdf.rio.RDFParseException;
import org.openrdf.rio.RDFParser;
import org.openrdf.rio.RioSetting;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
Expand All @@ -65,6 +69,8 @@ public abstract class SesameRDFaParser implements RDFParser {
private XMLReader xmlReader;
boolean stopAtFirstError = true;
private boolean preserveBNodeIds = false;
private ParseErrorListener parseErrorListener;
private ParserConfig parserConfig;

public static class HTMLRDFaParser extends SesameRDFaParser {

Expand Down Expand Up @@ -111,7 +117,7 @@ public void setRDFHandler(RDFHandler handler) {
}

public void setParseErrorListener(ParseErrorListener el) {
throw new UnsupportedOperationException("Not supported yet.");
this.parseErrorListener = el;
}

public void setParseLocationListener(ParseLocationListener ll) {
Expand Down Expand Up @@ -154,6 +160,21 @@ public void parse(Reader reader, String baseURI) throws IOException, RDFParseExc
parse(new InputSource(reader), baseURI);
}

@Override
public void setParserConfig(ParserConfig config) {
this.parserConfig = config;
}

@Override
public ParserConfig getParserConfig() {
return this.parserConfig;
}

@Override
public Collection<RioSetting<?>> getSupportedSettings() {
return null;
}

private void parse(InputSource in, String baseURI) throws IOException {
Parser parser = new Parser(new SesameStatementSink(valFact, handler));
parser.setBase(baseURI);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
net.rootdev.javardfa.RDFaXHtmlParserFactory
8 changes: 7 additions & 1 deletion src/test/java/net/rootdev/javardfa/FileBasedTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ private void compareRDF(URL htmlURL, URL compareURL) throws SAXException, IOExce
XMLReader parser = ParserFactory.createReaderForFormat(sink, Format.XHTML, Setting.OnePointOne);
parser.parse(hf);
boolean result = c.isIsomorphicWith(m);
if (!result) m.write(System.err, "TTL");
if (!result) {
System.err.println("===== "+htmlURL+" =====");
m.write(System.err, "TTL");
System.err.println("===== "+compareURL+" =====");
c.write(System.err, "TTL");

}
assertTrue("Files match (" + htmlURL + ")", result);
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/net/rootdev/javardfa/conformance2/SVG10.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static Collection<String[]> testFiles()
testFiles("http://rdfa.info/test-suite/rdfa1.0/svg/manifest",
"conformance2/manifest-extract.rq",
// Not an RDFa test!
"http://rdfa.info/test-suite/rdfa1.0/svg/0304"
"http://rdfa.info/test-suite/test-cases/rdfa1.0/svg/0304.svg"
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/net/rootdev/javardfa/conformance2/XML10.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public static Collection<String[]> testFiles()
testFiles("http://rdfa.info/test-suite/rdfa1.0/xml/manifest",
"conformance2/manifest-extract.rq",
// Exclude: test uses html base outside html. Badly migrated, I guess.
"http://rdfa.info/test-suite/rdfa1.0/xml/0210",
"http://rdfa.info/test-suite/test-cases/rdfa1.0/xml/0210.xml",
// Exclude: test namespaces are wrong. xhtml isn't mentioned, dc inclusion is dubious.
"http://rdfa.info/test-suite/rdfa1.0/xml/0212"
"http://rdfa.info/test-suite/test-cases/rdfa1.0/xml/0212.xml"

);
}
Expand Down
8 changes: 3 additions & 5 deletions src/test/java/net/rootdev/javardfa/conformance2/XML11.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ public class XML11 extends RDFaConformance
@Parameters
public static Collection<String[]> testFiles()
throws URISyntaxException, IOException {
if (false) return RDFaConformance.filterTests(RDFaConformance.
testFiles("http://rdfa.info/test-suite/rdfa1.1/xml/manifest",
"conformance2/manifest-extract-1.1.rq"
), 120);
return RDFaConformance.
testFiles("http://rdfa.info/test-suite/rdfa1.1/xml/manifest",
"conformance2/manifest-extract-1.1.rq"
"conformance2/manifest-extract-1.1.rq",
// Exclude: test stopped working with jena-3
"http://rdfa.info/test-suite/test-cases/rdfa1.1/xml/0319.xml"
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/test/resources/location-mapping.n3
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
[ lm:prefix
"http://rdfa.digitalbazaar.com/test-suite/test-cases/xhtml1/" ;
lm:altPrefix
"file:conformance/xhtml/"
"file:src/test/resources/conformance/xhtml/"
] ,
[ lm:prefix
"http://rdfa.digitalbazaar.com/test-suite/test-cases/html5/" ;
lm:altPrefix
"file:conformance/html5/"
"file:src/test/resources/conformance/html5/"
] ,
[ lm:prefix
"http://rdfa.digitalbazaar.com/test-suite/test-cases/html4/" ;
lm:altPrefix
"file:conformance/html4/"
"file:src/test/resources/conformance/html4/"
] ,
[
lm:name "http://philip.html5.org/demos/rdfa/tests.json" ;
Expand All @@ -24,6 +24,6 @@
lm:prefix
"http://rdfa.info/test-suite/" ;
lm:altPrefix
"file:conformance2/"
"file:src/test/resources/conformance2/"
]
.
3 changes: 2 additions & 1 deletion src/test/resources/query-tests/3.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

z:a ex:one "abcd" ;
ex:two "bcd" ;
ex:three "c<div xmlns=\"http://www.w3.org/1999/xhtml\" datatype=\"\" property=\"ex:four\">d</div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
ex:three "cd" ;
ex:four "d" ;
4 changes: 1 addition & 3 deletions src/test/resources/test-manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
1.html 1.rq
2.html 2.ttl
3.html 3.ttl
4.html 4.ttl
5.html 5.ttl
6.html 6.ttl
4.html 4.ttl