private void addProvenance(RepositoryConnection connection, Resource tempContext) throws RepositoryException, QueryEvaluationException, MalformedQueryException, DatatypeConfigurationException, Exception {

        // Get all the subjects we've added to the temp context
        List<URI> mergedUris = this.getUrisInContext(connection, tempContext);
        System.out.println("===getUrisInContext===" + mergedUris.toString());
        if (mergedUris.size() > 0) {

            // Follow the chain of "isPartOf" statements to find the root container
            URI container = this.getRootContainer(connection, mergedUris.get(0), null);

            // Create a unique log URI
            URI generatedByValue = this.createUniqueLogUri(connection, new Date(), container);

            // Add provenance info where not already present (change for Jena addProvenance())
            for (URI uri : mergedUris) {
                this.addProvenanceIfMissing(connection, uri, generatedByValue);
                System.out.println("=====mergedUris=======" + uri.stringValue());

            }

        }
    }