public KR2RMLMappingWriter() throws RepositoryException { initializeTripleStore(); initializeURIs(); }
public Boolean getNoMinimumNumberOfSatisifiedTerms() { if(noMinimumNumberOfSatisifiedTerms == null) { load(contextParameters); } return noMinimumNumberOfSatisifiedTerms; }
@POST @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML + "; charset=UTF-8", MediaType.APPLICATION_JSON + "; charset=UTF-8"}) public Response createReport( SimpleMessage message, @Context HttpHeaders headers ) { SimpleMessage convertedMessage; if(//condition//) { convertedMessage = new ReportMessage(); BeanUtils.copyProperties(convertedMessage, message); } else { ... } ... }
public static ErrorReport merge(ErrorReport first, ErrorReport second) { ErrorReport newReport = new ErrorReport(); for(ReportMessage msg : first.reports) { newReport.addReportMessage(msg); } for(ReportMessage otherMsg :second.reports) { newReport.addReportMessage(otherMsg); } return newReport; } public String toJSONString() throws JSONException {
@Override public String toString() { if (template != null) return "ObjectMap [\n" + "template=" + template + ",\n" + "rdfLiteralType=" + rdfLiteralType + ",\n" + "language=" + language + "]"; else if (refObjectMap != null) return "RefObjectMap [" + refObjectMap.getParentTriplesMap().getId() + "]"; else return "<No ObjectMap or RefObjectMap found for the ObjectMap!>"; }
public void shutdown(ErrorReport errorReport) { List<Runnable> unfinishedWorkers = service.shutdownNow(); for(Runnable unfinishedWorker : unfinishedWorkers) { if(unfinishedWorker instanceof TriplesMapWorker) { TriplesMapWorker unfinishedTriplesMapWorker = (TriplesMapWorker) unfinishedWorker; errorReport.addReportMessage(new ReportMessage("Triples Map Plan Execution Error", unfinishedTriplesMapWorker.toString() + " was unable to complete", Priority.high)); } } }
private ShortHandURI createShortHand(String URI, Prefix p) { if(URI.startsWith("<") || URI.endsWith(">")) { URI = URI.substring(URI.startsWith("<") ?1: 0, URI.endsWith(">")?URI.length()-1:URI.length()); } try{ return new ShortHandURI(p.getPrefix(), URI.substring(p.getNamespace().length())); } catch(Exception e) { return new ShortHandURI(null, URI); } }
private void addPredicateObjectMaps( KR2RMLMapping mapping, Resource mappingRes, TriplesMap trMap, URI trMapUri, Workspace workspace, Worksheet worksheet) throws RepositoryException { // Add the predicate object maps for (PredicateObjectMap pom:trMap.getPredicateObjectMaps()) { addPredicateObjectMap(mapping, mappingRes, trMapUri, workspace, pom, worksheet); } }
private void addTripleMaps(KR2RMLMapping mapping, Resource mappingRes, Worksheet worksheet, Workspace workspace) throws RepositoryException { /** Get the required data structures of R2RML **/ List<TriplesMap> triplesMapList = mapping.getTriplesMapList(); /** Add all the triple maps **/ for (TriplesMap trMap:triplesMapList) { addTripleMap(mapping, mappingRes, worksheet, workspace, trMap); } }
public ShortHandURI getShortHand(String URI) { Prefix p = prefixMapping.get(URI); if (p != null) { return createShortHand(URI, p); } for (Prefix prefix : prefixes) { if (URI.indexOf(prefix.getNamespace()) >= 0) { prefixMapping.put(URI, prefix); return createShortHand(URI, prefix); } } return new ShortHandURI(null, URI); }
private void populatePrefixToNamespaceMap(List<Prefix>prefixes) { for(Prefix prefix : prefixes) { this.prefixToNamespaceMap.put(prefix.getPrefix(), prefix.getNamespace()); } } }
public String toJSONString() throws JSONException { JSONArray repArr = new JSONArray(); for (ReportMessage rep:reports) { JSONObject repObj = new JSONObject(); repObj.put(JsonKeys.title.name(), rep.getTitle()); repObj.put(JsonKeys.description.name(), rep.getDescription()); repObj.put(JsonKeys.priority.name(), rep.getPriority()); repArr.put(repObj); } return repArr.toString(); }
public boolean addR2RMLMapping(KR2RMLMapping mapping, Worksheet worksheet, Workspace workspace) throws RepositoryException, JSONException { try { Resource mappingRes = addKR2RMLMappingResource(worksheet, mapping); addTripleMaps(mapping, mappingRes, worksheet, workspace); addPrefixes(mapping); } catch (OpenRDFException e) { logger.error("Error occured while generating RDF representation of R2RML data " + "structures.", e); } return true; }
private String generateShortHandURIFromContext(String uri) { if (uri.startsWith("<") && uri.endsWith(">")) { uri = uri.substring(1, uri.length() - 1); } String shortHandPredicateURI = contextInverseAtIdMapping.get(uri); if (shortHandPredicateURI == null) { shortHandPredicateURI = shortHandURIGenerator.getShortHand(uri).toString(); } return shortHandPredicateURI; }
public void addPrefixes(Collection<Prefix> prefixes) { shortHandURIGenerator.addPrefixes(prefixes); }
public URIFormatter(List<Prefix> prefixes, ErrorReport errorReport) { reportErrors = true; replacePrefixesWithNamespaces = true; prefixToNamespaceMap = new HashMap<>(); populatePrefixToNamespaceMap(prefixes); this.errorReport = errorReport; } public String getExpandedAndNormalizedUri(String uri) {
public KR2RMLWorksheetRDFGenerator(Worksheet worksheet, Workspace workspace, List<KR2RMLRDFWriter> writers, boolean addColumnContextInformation, KR2RMLMapping kr2rmlMapping, ErrorReport errorReport, SuperSelection sel) { initializeMemberVariables(worksheet, workspace, outputFileName, addColumnContextInformation, kr2rmlMapping, errorReport); this.outWriters.addAll(writers); this.selection = sel; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((priority == null) ? 0 : priority.hashCode()); result = prime * result + ((title == null) ? 0 : title.hashCode()); return result; }
@Override public String toString() { StringBuilder predStr = new StringBuilder(); for (PredicateObjectMap poMap:predicateObjectMaps) { predStr.append("\t\t\t" + poMap.toString() + "\n"); } return "TriplesMap [\n" + "\t\tid=" + id + ",\n" + "\t\tsubject=" + subject + ",\n" + "\t\tpredicateObjectMaps=\n" + predStr.toString() + "\n\t]"; }