<commit_before>webvowl.modules.datatypeFilter = function () {

	var filter = {},
		nodes,
		properties,
		enabled = false,
		filteredNodes,
		filteredProperties;


	/**
	 * If enabled, all datatypes and literals including connected properties are filtered.
	 * @param untouchedNodes
	 * @param untouchedProperties
	 */
	filter.filter = function (untouchedNodes, untouchedProperties) {
		nodes = untouchedNodes;
		properties = untouchedProperties;

		if (this.enabled()) {
			removeDatatypesAndLiterals();
		}

		filteredNodes = nodes;
		filteredProperties = properties;
	};

	function removeDatatypesAndLiterals() {
		var removedElements = [],
			cleanedNodes = [],
			cleanedProperties = [];

		nodes.forEach(function (node) {
			if (isDatatypeOrLiteral(node)) {
				removedElements.push(node);
			} else {
				cleanedNodes.push(node);
			}
		});

		properties.forEach(function (property) {
			var isDangling = false;
			for (var i = 0, l = removedElements.length; i < l; ++i) {
				var removedElement = removedElements[i];

				if (isDanglingProperty(property, removedElement)) {
					isDangling = true;
					break;
				}
			}

			if (!isDangling) {
				cleanedProperties.push(property);
			}
		});

		nodes = cleanedNodes;
		properties = cleanedProperties;
	}

	function isDatatypeOrLiteral(node) {
		if (node instanceof webvowl.nodes.rdfsdatatype ||
			node instanceof webvowl.nodes.rdfsliteral) {
			return true;
		}
		return false;
	}

	function isDanglingProperty(property, removedElement) {
		if (property.domain() === removedElement ||
			property.range() === removedElement) {
			return true;
		}
		return false;
	}

	filter.enabled = function (p) {<commit_msg>Simplify check if property is dangling<commit_after>webvowl.modules.datatypeFilter = function () {

	var filter = {},
		nodes,
		properties,
		enabled = false,
		filteredNodes,
		filteredProperties;


	/**
	 * If enabled, all datatypes and literals including connected properties are filtered.
	 * @param untouchedNodes
	 * @param untouchedProperties
	 */
	filter.filter = function (untouchedNodes, untouchedProperties) {
		nodes = untouchedNodes;
		properties = untouchedProperties;

		if (this.enabled()) {
			removeDatatypesAndLiterals();
		}

		filteredNodes = nodes;
		filteredProperties = properties;
	};

	function removeDatatypesAndLiterals() {
		var removedNodes = webvowl.util.set(),
			cleanedNodes = [],
			cleanedProperties = [];

		nodes.forEach(function (node) {
			if (isDatatypeOrLiteral(node)) {
				removedNodes.add(node);
			} else {
				cleanedNodes.push(node);
			}
		});

		properties.forEach(function (property) {
			if (!removedNodes.has(property.domain()) && !removedNodes.has(property.range())) {
				cleanedProperties.push(property);
			}
		});

		nodes = cleanedNodes;
		properties = cleanedProperties;
	}

	function isDatatypeOrLiteral(node) {
		if (node instanceof webvowl.nodes.rdfsdatatype ||
			node instanceof webvowl.nodes.rdfsliteral) {
			return true;
		}
		return false;
	}

	filter.enabled = function (p) {
{'fraction_non_alphanumeric': 0.1156778256546238, 'fraction_numerical': 0.00033145508783559825, 'mean_word_length': 3.859903381642512, 'pattern_counts': {'":': 0, '<': 4, '<?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': '116072', 'n_tokens_mistral': 1107, 'n_tokens_neox': 905, 'n_words': 196}