<commit_before>/*Copyright (c) 2019 "hbz"

This file is part of etikett.

etikett is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package helper;

import org.eclipse.rdf4j.rio.RDFFormat;

/**
 * @author <NAME>
 *
 */
public class LobidLabelResolver implements LabelResolver {
    final public static String id = "http://lobid.org/resources";
    final public static String id2 = "https://lobid.org/resources";
    public final static String DOMAIN = "lobid.org";

    /**
     * @param uri
     *            analyes data from the url to find a proper label
     * @return a label
     */
    public String lookup(String uri, String language) {
        try {
            String rdfAddress = uri;

            /**
             * Lobid uses http uris
             * 
             */
            String rdfUri = uri.replaceAll("https", "http");

            SparqlLookup SpL = new SparqlLookup();
            String label = SpL.lookup(uri, "<" + rdfUri + "#!>", "http://purl.org/dc/terms/title", language,
                    RDFFormat.RDFXML, "application/rdf+xml");
            if (rdfAddress.equals(label)) {
                label = SpL.lookup(uri, "<" + rdfUri + ">", "http://purl.org/dc/terms/title", language,
                        RDFFormat.RDFXML, "application/rdf+xml");
            }
            return label;
        } catch (Exception e) {
            return uri;
        }
    }

    @Override
    public void run() {
        // TODO Auto-generated method stub

    }
}<commit_msg>change format for lobid resources<commit_after>/*Copyright (c) 2019 "hbz"

This file is part of etikett.

etikett is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package helper;

import org.eclipse.rdf4j.rio.RDFFormat;

/**
 * @author <NAME>
 *
 */
public class LobidLabelResolver implements LabelResolver {
    final public static String id = "http://lobid.org/resources";
    final public static String id2 = "https://lobid.org/resources";
    public final static String DOMAIN = "lobid.org";

    /**
     * @param uri
     *            analyes data from the url to find a proper label
     * @return a label
     */
    public String lookup(String uri, String language) {
        try {
            String rdfAddress = uri;

            /**
             * Lobid uses http uris
             * 
             */
            String rdfUri = uri.replaceAll("https", "http");

            SparqlLookup SpL = new SparqlLookup();
            String label = SpL.lookup(rdfUri, "<" + rdfUri + "#!>", "http://purl.org/dc/terms/title", language,
                    RDFFormat.RDFXML, "application/rdf+xml");
            if (rdfAddress.equals(label)) {
                label = SpL.lookup(rdfUri, "<" + rdfUri + ">", "http://purl.org/dc/terms/title", language,
                        RDFFormat.RDFXML, "application/rdf+xml");
            }
            return label;
        } catch (Exception e) {
            return uri;
        }
    }

    @Override
    public void run() {
        // TODO Auto-generated method stub

    }
}
{'fraction_non_alphanumeric': 0.09759615384615385, 'fraction_numerical': 0.0033653846153846156, 'mean_word_length': 2.2841357537490135, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, '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': '3726450', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1144, 'n_words': 422}