<commit_before>/* Twine: RDF (quad) processing
 *
 * Author: <NAME> <<EMAIL>>
 *
 * Copyright (c) 2014 BBC
 *
 *  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.
 */

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdio.h>
#include <stdlib.h>

#include "libtwine.h"

static int process_rdf(const char *mime, const unsigned char *buf, size_t buflen, void *data);

/* Twine plug-in entry-point */
int
twine_plugin_init(void)
{
	twine_logf(LOG_DEBUG, "rdf plug-in: initialising\n");
	twine_plugin_register("application/trig", "RDF TriG", process_rdf, NULL);
	twine_plugin_register("application/nquads", "RDF N-Quads", process_rdf, NULL);
	return 0;
}

/* Process some kind of RDF and import the named graphs into the store
 *
 * Although in principle this processor can handle anything that librdf can
 * parse, it will do nothing unless there are named graphs present, and so
 * only N-Quads and TriG are listed in ../mimetypes.h
 */

static int
process_rdf(const char *mime, const unsigned char *buf, size_t buflen, void *data)
{
	librdf_model *model;<commit_msg>Register the correct MIME type for N-Quads.<commit_after>/* Twine: RDF (quad) processing
 *
 * Author: <NAME> <<EMAIL>>
 *
 * Copyright (c) 2014 BBC
 *
 *  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.
 */

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdio.h>
#include <stdlib.h>

#include "libtwine.h"

static int process_rdf(const char *mime, const unsigned char *buf, size_t buflen, void *data);

/* Twine plug-in entry-point */
int
twine_plugin_init(void)
{
	twine_logf(LOG_DEBUG, "rdf plug-in: initialising\n");
	twine_plugin_register("application/trig", "RDF TriG", process_rdf, NULL);
	twine_plugin_register("application/n-quads", "RDF N-Quads", process_rdf, NULL);
	twine_plugin_register("text/x-nquads", "RDF N-Quads", process_rdf, NULL);
	return 0;
}

/* Process some kind of RDF and import the named graphs into the store
 *
 * Although in principle this processor can handle anything that librdf can
 * parse, it will do nothing unless there are named graphs present, and so
 * only N-Quads and TriG are listed in ../mimetypes.h
 */

static int
process_rdf(const char *mime, const unsigned char *buf, size_t buflen, void *data)
{
	librdf_model *model;
{'fraction_non_alphanumeric': 0.09939024390243903, 'fraction_numerical': 0.00548780487804878, 'mean_word_length': 4.232854864433812, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6463542', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1028, 'n_words': 400}