public static String qnameFor(Resource resource) {
		Graph graph = resource.getModel().getGraph();
		if(graph instanceof MultiUnion) {
			String uri = resource.getURI();
	        int split = Util.splitNamespace(uri);
	        String local = uri.substring(split);
	        if (local.length() == 0) {
	        	return null;
	        }
	        String ns = uri.substring(0, split);
	        
	        MultiUnion mu = (MultiUnion) graph;
			Graph baseGraph = mu.getBaseGraph();
			if(baseGraph != null) {
				String prefix = baseGraph.getPrefixMapping().getNsURIPrefix(ns);
				if(prefix != null) {
					return prefix + ":" + local;
				}
			}
            List<Graph> graphs = mu.getSubGraphs();
            for (int i = 0; i < graphs.size(); i++) {
            	Graph subGraph = graphs.get(i);
            	String prefix = subGraph.getPrefixMapping().getNsURIPrefix(ns);
            	if(prefix != null && prefix.length() > 0) {
                	return prefix + ":" + local;
                }
            }
            return null;
		}
		else {
			return resource.getModel().qnameFor(resource.getURI());
		}
	}