final String template = term.getValue(); List<Variable> varList = new ArrayList<>(); TermUtils.addReferencedVariablesTo(varList, uriFunction);
/** * check if the term is {@code URI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")} * @param term * @return */ private static boolean isURIRDFType(Term term) { boolean result = true; if(term instanceof Function){ Function func = (Function) term; if (func.getArity() != 1){ result = false; } else { result = result && (func.getFunctionSymbol() instanceof URITemplatePredicate); result = result && (func.getTerm(0) instanceof ValueConstant) && ((ValueConstant) func.getTerm(0)).getValue(). equals(OBDAVocabulary.RDF_TYPE); } } else { result = false; } return result; }
Function uri = ((Function) term); if (uri.getFunctionSymbol() instanceof URITemplatePredicate) { String uriName = ((ValueConstant) uri.getTerm(0)).getValue(); if (uriName.startsWith(oldPrefix)) { uriName = uriName.replaceFirst(oldPrefix, newPrefix);
if(QueryUtils.isGrounded(object)) { ValueConstant c = ((ValueConstant) ((Function) object).getTerm(0)); // it has to be a URI constant Predicate predicate = dfac.getClassPredicate(c.getValue()); atom = dfac.getFunction(predicate, subject); } else { ValueConstant pr = (ValueConstant) ((Function) pred).getTerm(0); if (object instanceof Variable) { predicate = dfac.getPredicate(pr.getValue(), 2); } else { if (object instanceof Function) { if (((Function) object).getFunctionSymbol() instanceof URITemplatePredicate) { predicate = dfac.getObjectPropertyPredicate(pr.getValue()); } else { predicate = dfac.getDataPropertyPredicate(pr.getValue());
String predName = vconst.getValue(); Predicate newpred = fac.getPredicate(predName, 1); Function bodyAtom = fac.getFunction(newpred, subjectAtom);
String uriTemplate = ((ValueConstant) uriTermForPredicateTerm).getValue();
if (predf.getTerms().size() == 1) //fixed string pred = OBDADataFactoryImpl.getInstance().getPredicate(((ValueConstant)(predf.getTerm(0))).getValue(), 1); predUri = vf.createURI(pred.getName());
functionName = ((ValueConstant) ((Function)resource25).getTerm(0)).getValue(); } else { throw new IllegalArgumentException("resource25 should be an URI");
String functionName = ( (ValueConstant) ((Function)resource38).getTerm(0) ).getValue();
if (predf.getFunctionSymbol() instanceof URITemplatePredicate) { if (predf.getTerms().size() == 1) { //fixed string pred = OBDADataFactoryImpl.getInstance().getPredicate(((ValueConstant)(predf.getTerm(0))).getValue(), 1); predUri = vf.createURI(pred.getName());