<commit_before><!doctype html>
<html>
    <head>
        <title>VIE example</title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script>
            GENTICS_Aloha_base = 'http://aloha-editor.org/aloha-0.9.3/aloha/';

            jQuery(document).ready(function() {

                // Implement our own Backbone.sync method
                Backbone.sync = function(method, model, options) {
                    console.log(method, model.toJSON());
                };

                // Load collections from page so they can be managed
                VIE.CollectionManager.loadCollections();

                // Make all RDFa entities editable
                jQuery('[typeof][about]').each(function() {
                    jQuery(this).vieSemanticAloha();
                });

                jQuery('#savebutton').bind('click', function() {
                    // Go through all Backbone model instances loaded for the page
                    jQuery.each(VIE.ContainerManager.instances, function(index, objectInstance) {
                        var modifiedProperties = {};
                        console.log(objectInstance);

                        // Go through editables of the model instance
                        jQuery.each(objectInstance.editables, function(propertyName, editableInstance) {
                            if (!editableInstance.isModified()) {
                                // This editable hasn't been modified, skip
                                return true;
                            }
                            // Copy editable contents to the modifiedProperties object
                            modifiedProperties[propertyName] = editableInstance.getContents();
                        });

                        if (jQuery.isEmptyObject(modifiedProperties))
                        {
                            // No modified editables for this object, skip
                            return true;
                        }

                        // Set the modified properties to the model instance
                        objectInstance.save(modifiedProperties, {
                            success: function(savedModel, response) {
                                alert(savedModel.id + " was saved, see JS console for details");
                                jQuery.each(modifiedProperties, function(propertyName, propertyValue) {
                                    savedModel.editables[propertyName].setUnmodified();
                                });
                            },
                            error: function(response) {
                                console.log("Save failed");
                            }
                        });
                    });
                });

                jQuery('#addbutton').bind('click', function() {
                    VIE.CollectionManager.collections[0].add([{}]);
                });

                jQuery('#tweakbutton').bind('click', function() {
                    VIE.ContainerManager.instances[0].set({'dcterms:title': 'Hello, world!'});
                });
            });
        </script>
        <script src="http://aloha-editor.org/aloha-0.9.3/aloha/aloha.js"></script>
        <script src="http://aloha-editor.org/aloha-0.9.3/aloha/plugins/com.gentics.aloha.plugins.Format/plugin.js"></script>
        <script src="http://aloha-editor.org/aloha-0.9.3/aloha/plugins/com.gentics.aloha.plugins.HighlightEditables/plugin.js"></script>
        <script src="underscore-min.js"></script>
        <script src="backbone-min.js"></script>
        <script src="vie-containermanager.js"></script>
        <script src="vie-collectionmanager.js"></script>
        <script src="vie-aloha.js"></script>
    </head>
    <body>
        <p>Click on the content below to edit it, then <button id="savebutton">Save</button>, <button id="addbutton">Add item</button> or <button id="tweakbutton">Change via JS</button>.</p>

        <div typeof="http://purl.org/dc/dcmitype/Collection">
            <article typeof="http://rdfs.org/sioc/ns#Post" about="http://example.net/blog/news_item">
                <h1 property="dcterms:title">News item title</h1>
                <div property="sioc:content">
                    <p>
                        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
                    </p>
                    <p>
                        Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
                    </p>
                </div><commit_msg>Add relation to Collection elements and register the namespaces<commit_after><!doctype html>
<html>
    <head>
        <title>VIE example</title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script>
            GENTICS_Aloha_base = 'http://aloha-editor.org/aloha-0.9.3/aloha/';

            jQuery(document).ready(function() {

                // Implement our own Backbone.sync method
                Backbone.sync = function(method, model, options) {
                    console.log(method, model.toJSON());
                };

                // Make all RDFa entities editable
                jQuery('[typeof][about]').each(function() {
                    jQuery(this).vieSemanticAloha();
                });

                jQuery('#savebutton').bind('click', function() {
                    // Go through all Backbone model instances loaded for the page
                    jQuery.each(VIE.ContainerManager.instances, function(index, objectInstance) {
                        var modifiedProperties = {};

                        // Go through editables of the model instance
                        jQuery.each(objectInstance.editables, function(propertyName, editableInstance) {
                            if (!editableInstance.isModified()) {
                                // This editable hasn't been modified, skip
                                return true;
                            }
                            // Copy editable contents to the modifiedProperties object
                            modifiedProperties[propertyName] = editableInstance.getContents();
                        });

                        if (jQuery.isEmptyObject(modifiedProperties))
                        {
                            // No modified editables for this object, skip
                            return true;
                        }

                        // Set the modified properties to the model instance
                        objectInstance.save(modifiedProperties, {
                            success: function(savedModel, response) {
                                alert(savedModel.id + " was saved, see JS console for details");
                                jQuery.each(modifiedProperties, function(propertyName, propertyValue) {
                                    savedModel.editables[propertyName].setUnmodified();
                                });
                            },
                            error: function(response) {
                                console.log("Save failed");
                            }
                        });
                    });
                });

                jQuery('#tweakbutton').bind('click', function() {
                    VIE.ContainerManager.instances[0].set({'dcterms:title': 'Hello, world!'});
                });
            });
        </script>
        <script src="http://aloha-editor.org/aloha-0.9.3/aloha/aloha.js"></script>
        <script src="http://aloha-editor.org/aloha-0.9.3/aloha/plugins/com.gentics.aloha.plugins.Format/plugin.js"></script>
        <script src="http://aloha-editor.org/aloha-0.9.3/aloha/plugins/com.gentics.aloha.plugins.HighlightEditables/plugin.js"></script>
        <script src="underscore-min.js"></script>
        <script src="backbone-min.js"></script>
        <script src="vie-containermanager.js"></script>
        <script src="vie-aloha.js"></script>
    </head>
    <body>
        <p>Click on the content below to edit it, then <button id="savebutton">Save</button> or <button id="tweakbutton">Change via JS</button>.</p>

        <div xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:dcterms="http://purl.org/dc/terms/" typeof="http://purl.org/dc/dcmitype/Collection" rel="dcterms:hasPart">
            <article typeof="sioc:Post" about="http://example.net/blog/news_item">
                <h1 property="dcterms:title">News item title</h1>
                <div property="sioc:content">
                    <p>
                        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
                    </p>
                    <p>
                        Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
                    </p>
                </div>
{'fraction_non_alphanumeric': 0.09785486079415792, 'fraction_numerical': 0.0033774532177088088, 'mean_word_length': 1.731488406881077, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 89, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '180738', 'n_tokens_mistral': 2975, 'n_tokens_neox': 2782, 'n_words': 711}