private ArrayList<DAGNode> resolveAmbiguity(String nodename) throws IOException { if (resolvedNames_.containsKey(nodename)) { return resolvedNames_.get(nodename); } Collection<DAGNode> nodes = aliasModule_.findNodes(nodename, false, true); ArrayList<DAGNode> r = (ArrayList<DAGNode>) nodes; if (r.size() >= 1) { resolvedNames_.put(nodename, r); // _resolvedCount++; return r; } else { // _notFoundCount++; } // else { // r = getConcentratedConcept(nodename, nodes); // if (r != null) { // resolvedNames_.put(nodename, r); // _resolvedCount++; // return r; // } else // _notFoundCount++; // } return null; }
/** * Disambiguates all arguments into ontological collections * * @param args The arguments to disambiguate. * @param caseSensitive * @return An array of arguments, 2 dimensional for when an argument disambiguates to multiple * arguments. Non-disambiguatable terms are null. */ private DAGNode[][] disambiguateArguments(Object[] args, boolean caseSensitive) { DAGNode[][] disams = new DAGNode[args.length][]; for (int i = 0; i < args.length; i++) { if (args[i] instanceof DAGNode && isCollection((DAGNode) args[i])) disams[i] = new DAGNode[] {(DAGNode) args[i]}; else { try { DAGNode resourceBound = disambiguateSpecialString(args[i].toString()); if (isCollection(resourceBound)) disams[i] = new DAGNode[] {resourceBound}; } catch (UnknownMarkupException ume) { // Disambiguate text Collection<DAGNode> collections = new ArrayList<>(); Collection<DAGNode> results = nodeAliasModule_.findNodeByAlias(args[i].toString(), caseSensitive, true, true); for (DAGNode alias : results) { if (isCollection(alias)) collections.add(alias); } // Record each if (!collections.isEmpty()) disams[i] = collections.toArray(new DAGNode[collections.size()]); } } } return disams; }