/** * Constructor to start the parser from an RDF Model * @param model - the sesame Model containing mappings */ public R2RMLManager(Model model){ myModel = model; r2rmlParser = new R2RMLParser(); }
public Term getObjectAtom(PredicateObjectMap pom) { return getObjectAtom(pom, ""); }
@Deprecated public List<Resource> getJoinNodes(TriplesMap tm) { List<Resource> joinPredObjNodes = new ArrayList<Resource>(); // get predicate-object nodes Set<Resource> predicateObjectNodes = getPredicateObjects(tm); return joinPredObjNodes; }
Term subjectAtom = r2rmlParser.getSubjectAtom(tm); List<Predicate> classPredicates = r2rmlParser.getClassPredicates(); for (Predicate classPred : classPredicates) { body.add(fac.getFunction(classPred, subjectAtom)); List<Predicate> bodyPredicates = r2rmlParser.getBodyPredicates(pom); List<Function> bodyURIPredicates = r2rmlParser.getBodyURIPredicates(pom); Term objectAtom = r2rmlParser.getObjectAtom(pom);
List<Function> body = new ArrayList<Function>(); List<Term> terms = new ArrayList<Term>(); Term joinSubject1 = r2rmlParser.getSubjectAtom(tm); Term joinSubject2 = r2rmlParser.getSubjectAtom(parentTriple); terms.add(joinSubject1); terms.add(joinSubject2); List<Predicate> joinPredicates = r2rmlParser.getBodyPredicates(pobm); for (Predicate pred : joinPredicates) { Function bodyAtom = fac.getFunction(pred, terms);
if ((i = getIndexOfCurlyB(str)) > 0){ cons = str.substring(0, i); str = str.substring(str.indexOf("}", i)+1, str.length()); String var = trim(string.substring(begin + 1, end));
public Term getSubjectAtom(TriplesMap tm) throws Exception { return getSubjectAtom(tm, ""); }
/** * Get OBDA mapping axiom from R2RML TriplesMap * @param tm * @return * @throws Exception */ private OBDAMappingAxiom getMapping(TriplesMap tm) throws Exception { String sourceQuery = r2rmlParser.getSQLQuery(tm).trim(); List<Function> body = getMappingTripleAtoms(tm); //Function head = getHeadAtom(body); //CQIE targetQuery = fac.getCQIE(head, body); OBDAMappingAxiom mapping = fac.getRDBMSMappingAxiom("mapping-"+tm.hashCode(), fac.getSQLQuery(sourceQuery), body); if (body.isEmpty()){ //we do not have a target query System.out.println("WARNING a mapping without target query will not be introduced : "+ mapping.toString()); return null; } return mapping; }
Collection<TriplesMap> tripleMaps = r2rmlParser.getMappingNodes(myModel);
/** * Constructor to start parsing R2RML mappings from file. * @param file - the File object */ public R2RMLManager(File file) throws Exception { myModel = new LinkedHashModel(); RDFParser parser = Rio.createParser(RDFFormat.TURTLE); InputStream in = new FileInputStream(file); URL documentUrl = new URL("file://" + file); StatementCollector collector = new StatementCollector(myModel); parser.setRDFHandler(collector); parser.parse(in, documentUrl.toString()); r2rmlParser = new R2RMLParser(); }