<commit_before>package net.sansa_stack.rdf.spark.qualityassessment.metrics.performance

import org.apache.spark.rdd.RDD
import org.apache.jena.graph.{ Triple, Node }

import net.sansa_stack.rdf.spark.qualityassessment.utils.NodeUtils._

/**
 * @author <NAME>
 */
object NoHashURIs {
  implicit class NoHashURIsFunctions(dataset: RDD[Triple]) extends Serializable {
    def assessNoHashUris() = {

      val triples = dataset.count().toDouble

      val subjects = dataset.filter(f => f.getSubject.isURI() && isHashUri(f.getSubject)).count().toDouble
      val predicate = dataset.filter(f => isHashUri(f.getPredicate)).count().toDouble
      val objects = dataset.filter(f => f.getObject.isURI() && isHashUri(f.getObject)).count().toDouble

      val NoHashURIs = subjects + predicate + objects

      val value = if (triples > 0.0)
        NoHashURIs / triples;
      else 0

      value
    }
  }
}<commit_msg>Refactor performance metrics and make Scala-style compliant<commit_after>package net.sansa_stack.rdf.spark.qualityassessment.metrics.performance

import net.sansa_stack.rdf.spark.qualityassessment.utils.NodeUtils._
import org.apache.jena.graph.{ Node, Triple }
import org.apache.spark.rdd.RDD

/**
 * @author <NAME>
 */
object NoHashURIs {

  def assessNoHashUris(dataset: RDD[Triple]): Double = {

    val triples = dataset.count().toDouble

    val subjects = dataset.filter(f => f.getSubject.isURI() && isHashUri(f.getSubject)).count().toDouble
    val predicate = dataset.filter(f => isHashUri(f.getPredicate)).count().toDouble
    val objects = dataset.filter(f => f.getObject.isURI() && isHashUri(f.getObject)).count().toDouble

    val NoHashURIs = subjects + predicate + objects

    val value = if (triples > 0.0) {
      NoHashURIs / triples
    } else 0

    value
  }
}
{'fraction_non_alphanumeric': 0.12883435582822086, 'fraction_numerical': 0.0033463469046291134, 'mean_word_length': 3.746031746031746, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '1095668', 'n_tokens_mistral': 608, 'n_tokens_neox': 576, 'n_words': 110}