Examples of CssTextLiteralMapper


Examples of org.apache.marmotta.ldclient.provider.html.mapping.CssTextLiteralMapper

                    // when start is set, we only take the replies; we are in a second or further
                    // page of the topic
                    postMappings.put(Namespaces.NS_SIOC + "container_of", new PHPBBTopicHrefMapper("a.topictitle"));
                } else {
                    // otherwise we also take the initial title, creator and date for the topic
                    postMappings.put(Namespaces.NS_DC + "title", new CssTextLiteralMapper("div#pageheader a.titles"));
                    postMappings.put(Namespaces.NS_DC + "description", new CssTextLiteralMapper("div#pageheader span.forumdesc"));
                    postMappings.put(Namespaces.NS_SIOC + "container_of", new PHPBBTopicHrefMapper("a.topictitle"));

                    postMappings.put(Namespaces.NS_SIOC + "parent_of", new PHPBBForumHrefMapper("a.forumlink, a.forumtitle"));
                }
View Full Code Here

Examples of org.apache.marmotta.ldclient.provider.html.mapping.CssTextLiteralMapper

            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("&nbsp;", " ").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);
View Full Code Here

Examples of org.apache.marmotta.ldclient.provider.html.mapping.CssTextLiteralMapper

                if(params.containsKey("start")) {
                    // when start is set, we only take the replies; we are in a second or further page of the topic
                    postMappings.put(Namespaces.NS_SIOC + "container_of", new PHPBBPostIdMapper("div#pagecontent table td.gensmall a[name]"));
                } else {
                    // otherwise we also take the initial title, creator and date for the topic
                    postMappings.put(Namespaces.NS_DC + "title", new CssTextLiteralMapper("div#pageheader a.titles"));
                    postMappings.put(Namespaces.NS_DC + "creator", new CssTextLiteralMapper(new CssSelectorMapper.Selector() {
                        @Override
                        public Elements select(Element node) {
                            final Element first = node.select("div#pagecontent table b.postauthor").first();
                            if (first != null)
                                return new Elements(first);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.