@Override public ATermList concat(final ATermList rhs) { if (isEmpty()) return rhs; if (_next.isEmpty()) return rhs.insert(_first); return _next.concat(rhs).insert(_first); }
@Override public SList<ATerm> concat(final SList<ATerm> rhs) { if (isEmpty()) return rhs; if (_next.isEmpty()) return rhs.insert(_first); return _next.concat(rhs).insert(_first); }
/** * {@inheritDoc} TODO */ @Override public ATermAppl rollUpTo(final ATermAppl var, final Collection<ATermAppl> stopList, final boolean stopOnConstants) { if (getDistVarsForType(VarType.LITERAL).contains(var) && !getDistVarsForType(VarType.INDIVIDUAL).contains(var) && !_individualsAndLiterals.contains(var)) throw new InternalReasonerException("Trying to roll up to the variable '" + var + "' which is not distinguished and _individual."); ATermList classParts = ATermUtils.EMPTY_LIST; final Set<ATermAppl> visited = new HashSet<>(); if (stopOnConstants) visited.addAll(getConstants()); final Collection<QueryAtom> inEdges = findAtoms(QueryPredicate.PropertyValue, null, null, var); for (final QueryAtom a : inEdges) classParts = classParts.append(rollEdgeIn(QueryPredicate.PropertyValue, a, visited, stopList)); final Collection<QueryAtom> outEdges = findAtoms(QueryPredicate.PropertyValue, var, null, null); for (final QueryAtom a : outEdges) classParts = classParts.append(rollEdgeOut(QueryPredicate.PropertyValue, a, visited, stopList)); classParts = classParts.concat(getClasses(var)); return ATermUtils.makeAnd(classParts); }
/** * {@inheritDoc} TODO */ @Override public ATermAppl rollUpTo(final ATermAppl var, final Collection<ATermAppl> stopList, final boolean stopOnConstants) { if (getDistVarsForType(VarType.LITERAL).contains(var) && !getDistVarsForType(VarType.INDIVIDUAL).contains(var) && !_individualsAndLiterals.contains(var)) throw new InternalReasonerException("Trying to roll up to the variable '" + var + "' which is not distinguished and _individual."); ATermList classParts = ATermUtils.EMPTY_LIST; final Set<ATermAppl> visited = new HashSet<>(); if (stopOnConstants) visited.addAll(getConstants()); final Collection<QueryAtom> inEdges = findAtoms(QueryPredicate.PropertyValue, null, null, var); for (final QueryAtom a : inEdges) classParts = classParts.append(rollEdgeIn(QueryPredicate.PropertyValue, a, visited, stopList)); final Collection<QueryAtom> outEdges = findAtoms(QueryPredicate.PropertyValue, var, null, null); for (final QueryAtom a : outEdges) classParts = classParts.append(rollEdgeOut(QueryPredicate.PropertyValue, a, visited, stopList)); classParts = classParts.concat(getClasses(var)); return ATermUtils.makeAnd(classParts); }
/** * {@inheritDoc} TODO */ @Override public ATermAppl rollUpTo(final ATermAppl var, final Collection<ATermAppl> stopList, final boolean stopOnConstants) { if (getDistVarsForType(VarType.LITERAL).contains(var) && !getDistVarsForType(VarType.INDIVIDUAL).contains(var) && !_individualsAndLiterals.contains(var)) throw new InternalReasonerException("Trying to roll up to the variable '" + var + "' which is not distinguished and _individual."); ATermList classParts = ATermUtils.EMPTY_LIST; final Set<ATermAppl> visited = new HashSet<>(); if (stopOnConstants) visited.addAll(getConstants()); final Collection<QueryAtom> inEdges = findAtoms(QueryPredicate.PropertyValue, null, null, var); for (final QueryAtom a : inEdges) classParts = classParts.append(rollEdgeIn(QueryPredicate.PropertyValue, a, visited, stopList)); final Collection<QueryAtom> outEdges = findAtoms(QueryPredicate.PropertyValue, var, null, null); for (final QueryAtom a : outEdges) classParts = classParts.append(rollEdgeOut(QueryPredicate.PropertyValue, a, visited, stopList)); classParts = classParts.concat(getClasses(var)); return ATermUtils.makeAnd(classParts); }