if (params.containsKey("p")) {
// mappings for a reply that has directly been addressed using the ?p=... parameter
// to viewtopic.php, e.g. http://www.carving-ski.de/phpBB/viewtopic.php?p=119208
Map<String, JSoupMapper> commentMappings = new HashMap<String, JSoupMapper>();
commentMappings.put(Namespaces.NS_DC + "title",
new CssTextLiteralMapper(String.format("div#pagecontent table:has(a[name=p%s]) td.gensmall div", params.get("p"))) {
@Override
public List<Value> map(String resourceUri, Element elem, ValueFactory factory) {
final String val = elem.ownText().replaceFirst("^\\s*:", "").replaceAll(" ", " ").trim();
if (datatype != null)
return Collections.singletonList((Value) factory.createLiteral(val,
factory.createURI(Namespaces.NS_XSD + datatype)));
else
return Collections.singletonList((Value) factory.createLiteral(val));
}
@Override
public Elements select(Element htmlDoc) {
final Element first = super.select(htmlDoc).first();
return first != null ? new Elements(first) : new Elements();
}
});
commentMappings.put(Namespaces.NS_DC + "creator",
new CssTextLiteralMapper(String.format("div#pagecontent table:has(a[name=p%s]) .postauthor", params.get("p"))));
commentMappings.put(Namespaces.NS_DC + "description",
new CssTextLiteralMapper(String.format("div#pagecontent table:has(a[name=p%s]) div.postbody", params.get("p"))));
commentMappings.put(Namespaces.NS_DC + "date",
new PHPBBDateMapper(String.format("div#pagecontent td.gensmall:has(a[name=p%s]) div", params.get("p"))) {
@Override
public Elements select(Element htmlDoc) {
final Elements sel = super.select(htmlDoc);