<commit_before># 
#    Copyright (c) 2011 3 Round Stones Inc., Some rights reserved
# 
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
# 
#        http://www.apache.org/licenses/LICENSE-2.0
# 
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

@prefix xsd:<http://www.w3.org/2001/XMLSchema#>.
@prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>.
@prefix owl:<http://www.w3.org/2002/07/owl#>.
@prefix skos:<http://www.w3.org/2004/02/skos/core#>.
@prefix foaf:<http://xmlns.com/foaf/0.1/>.
@prefix msg:<http://www.openrdf.org/rdf/2011/messaging#>.
@prefix calli:<http://callimachusproject.org/rdf/2009/framework#>.
@prefix :<#>.

<> a <SchemaGraph>.

<Serviceable> a owl:Class;
    rdfs:label "Serviceable";
    rdfs:comment "All resources served by this host";
    rdfs:isDefinedBy </callimachus>.

:GetHistory rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:java.io.Reader>];
    calli:method "GET";
    calli:query "history";
    calli:rel "version-history";
    calli:requires calli:subscriber;
    calli:type "text/html";
    calli:header "cache-control:no-cache";
    calli:copy <pipelines/history-html.xpl?results&target=$0>.

:GetHistoryAtom rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:java.io.InputStream>];
    calli:method "GET";
    calli:query "history";
    calli:requires calli:subscriber;
    calli:type "application/atom+xml;q=0.9";
    calli:header "cache-control:no-store";
    calli:copy <pipelines/history-atom.xpl?results&target=$0>.

:GetDiscussion rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:java.io.Reader>];
    calli:method "GET";
    calli:query "discussion";
    calli:requires calli:reader;
    calli:type "text/html";
    calli:copy <pipelines/discussion.xpl?results&target=$0>.

skos:editorialNote a owl:AnnotationProperty.

:PostDiscussion rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:literal; owl:allValuesFrom xsd:string];
    calli:method "POST";
    calli:query "discussion";
    calli:requires calli:subscriber;
    calli:expect "303-see-other";
    calli:type "text/uri-list";
    calli:script """
        var vf = this.objectConnection.valueFactory;
        this.skosEditorialNote.add(form.get('note')[0]);
        return this.resource + "?discussion";
    """.

:form a owl:ObjectProperty, owl:FunctionalProperty;
    rdfs:domain :PostDiscussion;
    rdfs:range <java:java.util.Map>;
    calli:type "application/x-www-form-urlencoded";.

:inputStream a owl:ObjectProperty; a owl:FunctionalProperty;
    rdfs:domain :TransformDiscussion;
    rdfs:range <java:java.io.InputStream>;
    calli:type "application/sparql-results+xml".

:GetRelatedChanges rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:java.io.Reader>];
    calli:method "GET";
    calli:query "relatedchanges";
    calli:requires calli:subscriber;
    calli:type "text/html";
    calli:header "cache-control:no-store";
    calli:copy <pipelines/related-changes.xpl?results&target=$0>.

:GetWhatLinksHere rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:java.io.Reader>];
    calli:method "GET";
    calli:query "whatlinkshere";
    calli:requires calli:subscriber;
    calli:type "text/html";
    calli:copy <pipelines/what-links-here.xpl?results&target=$0>.

:GetIntrospect rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:literal; owl:allValuesFrom xsd:string];
    calli:method "GET";
    calli:query "introspect";
    calli:requires calli:subscriber;
    calli:type "text/html";
    calli:script """
        return this.TransformIntrospectLayout(this.calliIntrospect(this));
    """.

:TransformIntrospectLayout rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:literal; owl:allValuesFrom xsd:string];
    calli:post <pipelines/transform-layout.xpl?results&target=$0&systemId=$0&query=introspect>.

:xhtmlIntrospect a owl:FunctionalProperty, owl:ObjectProperty;
    rdfs:domain :TransformIntrospectLayout;
    rdfs:range <java:java.io.ByteArrayOutputStream>;
    calli:type "application/xhtml+xml".

################################
# GET describedby
################################

:GetRdfDescription rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:org.openrdf.query.GraphQueryResult>];
    calli:title "RDF Describe";
    calli:rel "describedby";
    calli:method "GET";
    calli:query "describe";
    calli:requires calli:reader;
    calli:type "application/rdf+xml;q=0.4", "text/turtle;q=0.5";
    calli:script """
        var queue = [];
        queue.push(this.resource);
        var con = this.objectConnection;
        var base = this.resource.stringValue();
        var baseIsHash = base.charAt(base.length - 1) == '#';
        var stmts = con.getStatements(null, org.openrdf.model.vocabulary.RDFS.ISDEFINEDBY, this.resource, false, []);
        try {
            while (stmts.hasNext()) {
                queue.push(stmts.next().subject);
            }
        } finally {
            stmts.close();
        }
        var last = null;
        return new org.openrdf.query.GraphQueryResult({
            close: function() {
                stmts.close();
            },
            getNamespaces: function() {
                var namespaces = con.getNamespaces();
                var map = new java.util.HashMap();
                while (namespaces.hasNext()) {
                    var ns = namespaces.next();
                    map.put(ns.getPrefix(), ns.getName());
                }
                return map;
            },
            hasNext: function() {
                while (!stmts.hasNext() && queue.length > 0) {
                    stmts.close();
                    stmts = con.getStatements(queue.shift(), null, null, false, []);
                }
                return stmts.hasNext();
            },
            next: function() {
                while (!stmts.hasNext() && queue.length > 0) {
                    stmts.close();
                    stmts = con.getStatements(queue.shift(), null, null, false, []);
                }
                var st = stmts.next();
                while (last != null && stmts.hasNext()
                        && st.subject == last.subject
                        && st.predicate == last.predicate
                        && st.object == last.object) {
                    st = stmts.next();
                }
                last = st;
                var uri = st.object.stringValue()
                if (st.object instanceof org.openrdf.model.URI) {
                    if (uri.length > base.length && uri.indexOf(base) == 0) {
                        var chr = uri.charAt(base.length);
                        if (baseIsHash || chr == '#') {
                            queue.push(st.object);
                        }
                    }
                } else if (st.object instanceof org.openrdf.model.Resource) {
                    queue.push(st.object);
                }
                return st;
            },
            remove: function() {
                stmts.remove();
            },
        });
    """.
<commit_msg>Fix infinite loop is describe page<commit_after># 
#    Copyright (c) 2011 3 Round Stones Inc., Some rights reserved
# 
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
# 
#        http://www.apache.org/licenses/LICENSE-2.0
# 
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

@prefix xsd:<http://www.w3.org/2001/XMLSchema#>.
@prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>.
@prefix owl:<http://www.w3.org/2002/07/owl#>.
@prefix skos:<http://www.w3.org/2004/02/skos/core#>.
@prefix foaf:<http://xmlns.com/foaf/0.1/>.
@prefix msg:<http://www.openrdf.org/rdf/2011/messaging#>.
@prefix calli:<http://callimachusproject.org/rdf/2009/framework#>.
@prefix :<#>.

<> a <SchemaGraph>.

<Serviceable> a owl:Class;
    rdfs:label "Serviceable";
    rdfs:comment "All resources served by this host";
    rdfs:isDefinedBy </callimachus>.

:GetHistory rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:java.io.Reader>];
    calli:method "GET";
    calli:query "history";
    calli:rel "version-history";
    calli:requires calli:subscriber;
    calli:type "text/html";
    calli:header "cache-control:no-cache";
    calli:copy <pipelines/history-html.xpl?results&target=$0>.

:GetHistoryAtom rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:java.io.InputStream>];
    calli:method "GET";
    calli:query "history";
    calli:requires calli:subscriber;
    calli:type "application/atom+xml;q=0.9";
    calli:header "cache-control:no-store";
    calli:copy <pipelines/history-atom.xpl?results&target=$0>.

:GetDiscussion rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:java.io.Reader>];
    calli:method "GET";
    calli:query "discussion";
    calli:requires calli:reader;
    calli:type "text/html";
    calli:copy <pipelines/discussion.xpl?results&target=$0>.

skos:editorialNote a owl:AnnotationProperty.

:PostDiscussion rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:literal; owl:allValuesFrom xsd:string];
    calli:method "POST";
    calli:query "discussion";
    calli:requires calli:subscriber;
    calli:expect "303-see-other";
    calli:type "text/uri-list";
    calli:script """
        var vf = this.objectConnection.valueFactory;
        this.skosEditorialNote.add(form.get('note')[0]);
        return this.resource + "?discussion";
    """.

:form a owl:ObjectProperty, owl:FunctionalProperty;
    rdfs:domain :PostDiscussion;
    rdfs:range <java:java.util.Map>;
    calli:type "application/x-www-form-urlencoded";.

:inputStream a owl:ObjectProperty; a owl:FunctionalProperty;
    rdfs:domain :TransformDiscussion;
    rdfs:range <java:java.io.InputStream>;
    calli:type "application/sparql-results+xml".

:GetRelatedChanges rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:java.io.Reader>];
    calli:method "GET";
    calli:query "relatedchanges";
    calli:requires calli:subscriber;
    calli:type "text/html";
    calli:header "cache-control:no-store";
    calli:copy <pipelines/related-changes.xpl?results&target=$0>.

:GetWhatLinksHere rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:java.io.Reader>];
    calli:method "GET";
    calli:query "whatlinkshere";
    calli:requires calli:subscriber;
    calli:type "text/html";
    calli:copy <pipelines/what-links-here.xpl?results&target=$0>.

:GetIntrospect rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:literal; owl:allValuesFrom xsd:string];
    calli:method "GET";
    calli:query "introspect";
    calli:requires calli:subscriber;
    calli:type "text/html";
    calli:script """
        return this.TransformIntrospectLayout(this.calliIntrospect(this));
    """.

:TransformIntrospectLayout rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:literal; owl:allValuesFrom xsd:string];
    calli:post <pipelines/transform-layout.xpl?results&target=$0&systemId=$0&query=introspect>.

:xhtmlIntrospect a owl:FunctionalProperty, owl:ObjectProperty;
    rdfs:domain :TransformIntrospectLayout;
    rdfs:range <java:java.io.ByteArrayOutputStream>;
    calli:type "application/xhtml+xml".

################################
# GET describedby
################################

:GetRdfDescription rdfs:subClassOf msg:Message;
    rdfs:subClassOf [owl:onProperty msg:target; owl:allValuesFrom <Serviceable>];
    rdfs:subClassOf [owl:onProperty msg:object; owl:allValuesFrom <java:org.openrdf.query.GraphQueryResult>];
    calli:title "RDF Describe";
    calli:rel "describedby";
    calli:method "GET";
    calli:query "describe";
    calli:requires calli:reader;
    calli:type "application/rdf+xml;q=0.4", "text/turtle;q=0.5";
    calli:script """
        var seen = {};
        seen[this.resource] = true;
        var queue = [];
        queue.push(this.resource);
        var con = this.objectConnection;
        var base = this.resource.stringValue();
        var baseIsHash = base.charAt(base.length - 1) == '#';
        var stmts = con.getStatements(null, org.openrdf.model.vocabulary.RDFS.ISDEFINEDBY, this.resource, false, []);
        try {
            while (stmts.hasNext()) {
                queue.push(stmts.next().subject);
            }
        } finally {
            stmts.close();
        }
        var last = null;
        return new org.openrdf.query.GraphQueryResult({
            close: function() {
                stmts.close();
            },
            getNamespaces: function() {
                var namespaces = con.getNamespaces();
                var map = new java.util.HashMap();
                while (namespaces.hasNext()) {
                    var ns = namespaces.next();
                    map.put(ns.getPrefix(), ns.getName());
                }
                return map;
            },
            hasNext: function() {
                while (!stmts.hasNext() && queue.length > 0) {
                    stmts.close();
                    stmts = con.getStatements(queue.shift(), null, null, false, []);
                }
                return stmts.hasNext();
            },
            next: function() {
                while (!stmts.hasNext() && queue.length > 0) {
                    stmts.close();
                    stmts = con.getStatements(queue.shift(), null, null, false, []);
                }
                var st = stmts.next();
                while (last != null && stmts.hasNext()
                        && st.subject == last.subject
                        && st.predicate == last.predicate
                        && st.object == last.object) {
                    st = stmts.next();
                }
                last = st;
                var uri = st.object.stringValue()
                if (st.object instanceof org.openrdf.model.URI) {
                    if (uri.length > base.length && uri.indexOf(base) == 0) {
                        var chr = uri.charAt(base.length);
                        if (baseIsHash || chr == '#' && !seen[st.object]) {
                            seen[st.object] = true;
                            queue.push(st.object);
                        }
                    }
                } else if (st.object instanceof org.openrdf.model.Resource) {
                    if (!seen[st.object]) {
                        seen[st.object] = true;
                        queue.push(st.object);
                    }
                }
                return st;
            },
            remove: function() {
                stmts.remove();
            },
        });
    """.

{'fraction_non_alphanumeric': 0.13860642477467067, 'fraction_numerical': 0.00866651259533164, 'mean_word_length': 2.7546637744034705, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 83, 'https://': 0, 'lorem ipsum': 0, 'www.': 16, 'xml': 10}, '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': '6327143', 'n_tokens_mistral': 5773, 'n_tokens_neox': 5439, 'n_words': 1024}