private void addLocations(HTMLDocument doc, Resource entry) throws ExtractionException { List<Node> nodes = doc.findAllByClassName( Microformats2Prefixes.PROPERTY_PREFIX + entryFields[11] + Microformats2Prefixes.SPACE_SEPARATOR + Microformats2Prefixes.CLASS_PREFIX + "geo"); if (nodes.isEmpty()) return; for (Node node : nodes) { BNode location = valueFactory.createBNode(); addURIProperty(location, RDF.TYPE, vEntry.location); HTMLDocument fragment = new HTMLDocument(node); for (String field : geoFields) { HTMLDocument.TextField[] values = fragment.getPluralTextField(Microformats2Prefixes.PROPERTY_PREFIX + field); for (HTMLDocument.TextField val : values) { Node attribute = val.source().getAttributes().getNamedItem("title"); if (attribute == null) { conditionallyAddStringProperty( val.source(), location, vVCARD.getProperty(field), val.value()); } else { conditionallyAddStringProperty( val.source(), location, vVCARD.getProperty(field), attribute.getNodeValue()); } } } } }
private void addSkills(HTMLDocument doc, Resource person) { final HTMLDocument.TextField[] skills = doc.getPluralTextField(Microformats2Prefixes.PROPERTY_PREFIX + resumeFields[5]); for (HTMLDocument.TextField skill : skills) { conditionallyAddStringProperty(skill.source(), person, vResume.skill, skill.value()); } }
private void addSyndications(HTMLDocument fragment, BNode entry) throws ExtractionException { final HTMLDocument.TextField[] syndications = fragment.getPluralUrlField(Microformats2Prefixes.URL_PROPERTY_PREFIX + entryFields[8]); for (HTMLDocument.TextField syndication : syndications) { addURIProperty(entry, vEntry.syndication, fragment.resolveURI(syndication.value())); } }
private void addURLs(HTMLDocument fragment, BNode entry) throws ExtractionException { final HTMLDocument.TextField[] urls = fragment.getPluralUrlField(Microformats2Prefixes.URL_PROPERTY_PREFIX + entryFields[6]); for (HTMLDocument.TextField url : urls) { addURIProperty(entry, vEntry.url, fragment.resolveURI(url.value())); } }
private void addCategories(HTMLDocument fragment, BNode entry) { final HTMLDocument.TextField[] categories = fragment.getPluralTextField(Microformats2Prefixes.PROPERTY_PREFIX + entryFields[5]); for (HTMLDocument.TextField category : categories) { conditionallyAddStringProperty(category.source(), entry, vEntry.category, category.value()); } }
private void addUpdated(HTMLDocument fragment, BNode entry) { final HTMLDocument.TextField[] durations = fragment.getPluralTextField(Microformats2Prefixes.TIME_PROPERTY_PREFIX + entryFields[4]); for (HTMLDocument.TextField duration : durations) { Node attribute = duration.source().getAttributes().getNamedItem("datetime"); if (attribute == null) { conditionallyAddStringProperty(duration.source(), entry, vEntry.updated, duration.value()); } else { conditionallyAddStringProperty( duration.source(), entry, vEntry.updated, attribute.getNodeValue()); } } }
private void addSummary(HTMLDocument doc, Resource person) { HTMLDocument.TextField summary = doc.getSingularTextField(Microformats2Prefixes.PROPERTY_PREFIX + resumeFields[1]); conditionallyAddStringProperty(summary.source(), person, vResume.summary, summary.value()); }
private void addName(HTMLDocument doc, Resource person) { HTMLDocument.TextField name = doc.getSingularTextField(Microformats2Prefixes.PROPERTY_PREFIX + resumeFields[0]); conditionallyAddStringProperty(name.source(), person, vResume.name, name.value()); }
private void addInReplyTo(HTMLDocument fragment, BNode entry) throws ExtractionException { final HTMLDocument.TextField inReplyTo = fragment.getSingularTextField(Microformats2Prefixes.URL_PROPERTY_PREFIX + entryFields[9]); if (inReplyTo.source() == null) return; addURIProperty(entry, vEntry.in_reply_to, fragment.resolveURI(inReplyTo.value())); }
private void addUID(HTMLDocument fragment, BNode entry) throws ExtractionException { final HTMLDocument.TextField uid = fragment.getSingularTextField(Microformats2Prefixes.URL_PROPERTY_PREFIX + entryFields[7]); if (uid.source() == null) return; addURIProperty(entry, vEntry.uid, fragment.resolveURI(uid.value())); }
private void mapFieldWithProperty( HTMLDocument fragment, BNode entry, String fieldClass, URI property) { HTMLDocument.TextField title = fragment.getSingularTextField(fieldClass); conditionallyAddStringProperty(title.source(), entry, property, title.value()); }