<commit_before>(function() {
    angular
        .module("templateStoreService", [])
        .factory("TemplateStore", TemplateStore);

    function TemplateStore() {
        var service, _resourceToFirstClassMap, _resourceTemplates, _resourceTypes, _typeMap, _idToTemplate, _profiles;

        service = {
            addResourceFirstClass: addResourceFirstClass,
            getResourceFirstClass: getResourceFirstClass,
            addResourceTemplate: addResourceTemplate,
            hasTemplateByClassID: hasTemplateByClassID,
            getTemplateByClassID: getTemplateByClassID,
            hasTemplateByID: hasTemplateByID,
            getTemplateByID: getTemplateByID,
            getTemplateIDHash: getTemplateIDHash,
            addResourceType: addResourceType,
            getReferenceResourceType: getReferenceResourceType,
            getTypeProperties: getTypeProperties,
            addProfile: addProfile,
            getProfiles: getProfiles
        };

        _resourceToFirstClassMap = {};
        _resourceTemplates = {};
        _resourceTypes = {};
        _typeMap = {};
        _idToTemplate = {};
        _profiles = [];

        return service;

        function addResourceFirstClass(res, fc) {
            _resourceToFirstClassMap[res] = fc;
        }

        function getResourceFirstClass(res) {
            return _resourceToFirstClassMap[res];
        }

        function addResourceTemplate(template) {
            _resourceTemplates[template.getClassID()] = template;
        }

        function hasTemplateByClassID(id) {
            return typeof _resourceTemplates[id] !== "undefined";
        }

        function getTemplateByClassID(id) {
            return _resourceTemplates[id];
        }

        function hasTemplateByID(id) {
            return typeof _idToTemplate[id] !== "undefined";
        }

        function getTemplateByID(id) {
            return _idToTemplate[id];
        }

        function getTemplateIDHash() {
            return _idToTemplate;
        }

        function getReferenceResourceType(ref) {
            if (hasTemplateByID(ref)) {
                return _resourceTypes[_idToTemplate[ref].getClassID()];
            } else {
                return null;
            }
        }

        function addResourceType(uri, type) {
            if (typeof type === "string") {
                _resourceTypes[uri] = type;
            } else {
                _resourceTypes[uri] = type.type;
                _typeMap[type.type] = type.propertyMap;
            }
        }

        function getTypeProperties(type) {
            return _typeMap[type];
        }

        function addProfile(profile) {
            _profiles.push(profile);
        }

        function getProfiles() {
            return _profiles;
        }
    }
    
})();
<commit_msg>add mapping from URI to profile ID, get rid of direct access to hash, and add a callback method to assist with profile registration<commit_after>(function() {
    angular
        .module("templateStoreService", [])
        .factory("TemplateStore", TemplateStore);

    function TemplateStore() {
        var service, _resourceToFirstClassMap, _resourceTemplates, _resourceTypes, _typeMap, _idToTemplate, _profiles;

        service = {
            addResourceFirstClass: addResourceFirstClass,
            getResourceFirstClass: getResourceFirstClass,
            addResourceTemplate: addResourceTemplate,
            hasTemplateByClassID: hasTemplateByClassID,
            getTemplateByClassID: getTemplateByClassID,
            hasTemplateByID: hasTemplateByID,
            getTemplateByID: getTemplateByID,
            addTemplate: addTemplate,
            identifiersFromClassID: identifiersFromClassID,
            addResourceType: addResourceType,
            getReferenceResourceType: getReferenceResourceType,
            getTypeProperties: getTypeProperties,
            addProfile: addProfile,
            getProfiles: getProfiles
        };

        _resourceToFirstClassMap = {};
        _resourceTemplates = {};
        _resourceTypes = {};
        _typeMap = {};
        _idToTemplate = {};
        _classIDToID = {};
        _profiles = [];

        return service;

        function addResourceFirstClass(res, fc) {
            _resourceToFirstClassMap[res] = fc;
        }

        function getResourceFirstClass(res) {
            return _resourceToFirstClassMap[res];
        }

        function addResourceTemplate(template) {
            _resourceTemplates[template.getClassID()] = template;
        }

        function hasTemplateByClassID(id) {
            return typeof _resourceTemplates[id] !== "undefined";
        }

        function getTemplateByClassID(id) {
            return _resourceTemplates[id];
        }

        function hasTemplateByID(id) {
            return typeof _idToTemplate[id] !== "undefined";
        }

        function getTemplateByID(id) {
            return _idToTemplate[id];
        }

        function addTemplate(id, cid, tmpl) {
            _idToTemplate[id] = tmpl;
            if (typeof _classIDToID[cid] !== "undefined") {
                _classIDToID[cid].push(id);
            } else {
                _classIDToID[cid] = [id];
            }
        }

        function identifiersFromClassID(cid) {
            if (typeof _classIDToID[cid] !== "undefined") {
                return _classIDToID[cid];
            } else {
                return null;
            }
        }

        function getReferenceResourceType(ref) {
            if (hasTemplateByID(ref)) {
                return _resourceTypes[_idToTemplate[ref].getClassID()];
            } else {
                return null;
            }
        }

        function addResourceType(uri, type) {
            if (typeof type === "string") {
                _resourceTypes[uri] = type;
            } else {
                _resourceTypes[uri] = type.type;
                _typeMap[type.type] = type.propertyMap;
            }
        }

        function getTypeProperties(type) {
            return _typeMap[type];
        }

        function addProfile(profile) {
            _profiles.push(profile);
        }

        function getProfiles() {
            return _profiles;
        }
    }
    
})();

{'fraction_non_alphanumeric': 0.08430651095824668, 'fraction_numerical': 0.0, 'mean_word_length': 1.8731617647058822, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1997491', 'n_tokens_mistral': 1614, 'n_tokens_neox': 1574, 'n_words': 289}