private static List<Triple> generateTriples_ResourceVenue_upcoming( URI uri, List<Triple> url_triples) throws URISyntaxException { List<Triple> valid_triples = new ArrayList<Triple>(); valid_triples.add(new Triple(uri.toString(), "wam:domain", "upcoming.yahoo.com")); valid_triples.add(new Triple(uri.toString(), "wam:type", "wam:Resource")); valid_triples.add(new Triple(uri.toString(), "wam:type", "wam:Venue")); valid_triples.add(new Triple(uri.toString(), "wam:URI", uri.toString())); valid_triples.add(new Triple(uri.toString(), "wam:url", uri.toString())); String title = "", locality = ""; if (url_triples.isEmpty()) { /* * GET MORE INFO WITH ANY23 */ String n3s = MetadataEvalFunc.exec(uri.toString()); url_triples = new TripleNxParser().parse(n3s); logger.info(" GET MORE INFO for Venue : " + uri.toString()); } for (Triple triple : url_triples) { if (triple.predicate.equals(Constants.NS_RDF + "type") || triple.predicate.equals(Constants.NS_VCARD + "latitude") || triple.predicate.equals(Constants.NS_VCARD + "longitude") || triple.predicate.equals(Constants.NS_VCARD + "fn") || triple.predicate.equals(Constants.NS_VCARD + "street-address") || triple.predicate.equals(Constants.NS_VCARD + "region") || triple.predicate.equals(Constants.NS_VCARD + "postal-code")) { valid_triples.add(new Triple(uri.toString(), triple.predicate, triple.object)); } if ((triple.subject.equals(uri.toString()) && triple.predicate.equals(Constants.NS_DC + "title"))) { title = triple.object; valid_triples.add(new Triple(uri.toString(), triple.predicate, triple.object)); } if (triple.predicate.equals(Constants.NS_VCARD + "locality")) { locality = triple.object; valid_triples.add(new Triple(uri.toString(), triple.predicate, triple.object)); } } List<Triple> final_urltriples = new ArrayList<Triple>(); URI duplicate_uri = getDuplicate(uri, "wam:Venue", title, locality); if (duplicate_uri != null) { final_urltriples.add(new Triple(uri.toString(), "wam:hasResource", duplicate_uri.toString())); } else { if (!title.isEmpty()) { final_urltriples.addAll(valid_triples); } } return final_urltriples; }
private static List<Triple> generateTriples_ResourceVideo( URI uri, String title, String performer_name, String domain) { logger.info(" TRIPLES VIDEOS: " + uri.toString() + ", videoTitle:" + title); List<Triple> valid_triples = new ArrayList<Triple>(); valid_triples.add(new Triple(uri.toString(), "wam:domain", domain)); valid_triples.add(new Triple(uri.toString(), "wam:type", "wam:Resource")); valid_triples.add(new Triple(uri.toString(), "wam:type", "wam:Video")); valid_triples.add(new Triple(uri.toString(), "wam:URI", uri.toString())); valid_triples.add(new Triple(uri.toString(), "wam:url", uri.toString())); valid_triples.add(new Triple(uri.toString(), Constants.NS_DC + "title", title)); if (!performer_name.isEmpty()) { valid_triples.add(new Triple(uri.toString(), "wam:performerName", performer_name)); } try { String n3s = MetadataEvalFunc.exec(uri.toString()); List<Triple> url_triples = new TripleNxParser().parse(n3s); if (!url_triples.isEmpty()) { logger.info(" GET MORE INFO WITH ANY23 for VIDEO : " + uri.toString()); for (Triple triple : url_triples) { if (triple.predicate.equals(Constants.NS_XHTML + "keywords") || triple.predicate.equals(Constants.NS_XHTML + "description")) { valid_triples.add(new Triple(uri.toString(), triple.predicate, triple.object)); } } } } catch (Exception e) { e.printStackTrace(); } List<Triple> final_urltriples = new ArrayList<Triple>(); URI duplicate_uri = getDuplicate(uri, "wam:Video", title, ""); if (duplicate_uri != null) { final_urltriples.add(new Triple(uri.toString(), "wam:hasResource", duplicate_uri.toString())); } else { if (!title.isEmpty()) { final_urltriples.addAll(valid_triples); } } return final_urltriples; }
private static List<Triple> generateTriples_ResourcePerformer_eventful( URI uri, List<Triple> url_triples) throws URISyntaxException { List<Triple> valid_triples = new ArrayList<Triple>(); valid_triples.add(new Triple(uri.toString(), "wam:domain", "eventful.com")); valid_triples.add(new Triple(uri.toString(), "wam:type", "wam:Resource")); valid_triples.add(new Triple(uri.toString(), "wam:type", "wam:Performer")); valid_triples.add(new Triple(uri.toString(), "wam:URI", uri.toString())); valid_triples.add(new Triple(uri.toString(), "wam:url", uri.toString())); String title = ""; if (url_triples.isEmpty()) { /* * GET MORE INFO WITH ANY23 */ logger.info(" GET MORE INFO WITH ANY23: " + uri.toString()); String n3s = MetadataEvalFunc.exec(uri.toString()); url_triples = new TripleNxParser().parse(n3s); } for (Triple triple : url_triples) { if (triple.predicate.equals(Constants.NS_OG + "type") || (triple.subject.equals(uri.toString()) && triple.predicate.equals(Constants.NS_OG + "url"))) { valid_triples.add(new Triple(uri.toString(), triple.predicate, triple.object)); } if (triple.predicate.equals(Constants.NS_OG + "title")) { title = triple.object; valid_triples.add(new Triple(uri.toString(), triple.predicate, triple.object)); } } List<Triple> final_urltriples = new ArrayList<Triple>(); URI duplicate_uri = getDuplicate(uri, "wam:Performer", title, ""); if (duplicate_uri != null) { final_urltriples.add(new Triple(uri.toString(), "wam:hasResource", duplicate_uri.toString())); } else { if (!title.isEmpty()) { final_urltriples.addAll(valid_triples); } } return final_urltriples; }