<commit_before>'use strict'

angular.module 'app'
  .controller 'PublishCtrl', ($scope, $timeout, $window, _, Rdb, Rdf, Sml, Transform) ->

    $scope.rdb = Rdb
    $scope.rdf = Rdf
    $scope.sml = Sml
    $scope.transform = Transform

    $scope.publishing = false
    $scope.success = false

    $scope.dump = () ->
      mapping =
        tables: $scope.rdb.selectedTables()
        columns: $scope.rdb.selectedColumns()
        baseUri: $scope.rdf.baseUri
        subjectTemplate: $scope.rdf.subjectTemplate
        classes: $scope.rdf.selectedClasses
        properties: $scope.rdf.selectedProperties
        literals: $scope.rdf.propertyLiteralSelection
        literalTypes: $scope.rdf.propertyLiteralTypes

      w = $window.open ''
      $scope.mapping = $scope.sml.toSml mapping
      $scope.transform.getDumpUrl $scope.mapping
        .then (url) ->
          w.location = url

    $scope.mapping = () ->
      mapping =
        tables: $scope.rdb.selectedTables()
        columns: $scope.rdb.selectedColumns()
        baseUri: $scope.rdf.baseUri
        subjectTemplate: $scope.rdf.subjectTemplate
        classes: $scope.rdf.selectedClasses
        properties: $scope.rdf.selectedProperties
        literals: $scope.rdf.propertyLiteralSelection
        literalTypes: $scope.rdf.propertyLiteralTypes

      $scope.mapping = $scope.sml.toSml mapping
      w = $window.open ''
      w.document.open()
      w.document.write '<pre>' + $scope.mapping + '</pre>'
      w.document.close()

    $scope.publish = () ->
      $scope.publishing = true
      mapping =
        tables: $scope.rdb.selectedTables()
        columns: $scope.rdb.selectedColumns()
        baseUri: $scope.rdf.baseUri
        subjectTemplate: $scope.rdf.subjectTemplate
        classes: $scope.rdf.selectedClasses
        properties: $scope.rdf.selectedProperties
        literals: $scope.rdf.propertyLiteralSelection
        literalTypes: $scope.rdf.propertyLiteralTypes

      $scope.publishing = false
      $scope.success = true
      $scope.mapping = $scope.sml.toSml mapping
      # $scope.transform.publish $scope.mapping<commit_msg>bugfix<commit_after>'use strict'

angular.module 'app'
  .controller 'PublishCtrl', ($scope, $timeout, $window, _, Rdb, Rdf, Sml, Transform) ->

    $scope.rdb = Rdb
    $scope.rdf = Rdf
    $scope.sml = Sml
    $scope.transform = Transform

    $scope.publishing = false
    $scope.success = false

    $scope.dump = () ->
      mapping =
        tables: $scope.rdb.selectedTables()
        columns: $scope.rdb.selectedColumns()
        baseUri: $scope.rdf.baseUri
        subjectTemplate: $scope.rdf.subjectTemplate
        classes: $scope.rdf.selectedClasses
        properties: $scope.rdf.selectedProperties
        literals: $scope.rdf.propertyLiteralSelection
        literalTypes: $scope.rdf.propertyLiteralTypes

      w = $window.open ''
      $scope.currentMapping = $scope.sml.toSml mapping
      $scope.transform.getDumpUrl $scope.currentMapping
        .then (url) ->
          w.location = url

    $scope.mapping = () ->
      mapping =
        tables: $scope.rdb.selectedTables()
        columns: $scope.rdb.selectedColumns()
        baseUri: $scope.rdf.baseUri
        subjectTemplate: $scope.rdf.subjectTemplate
        classes: $scope.rdf.selectedClasses
        properties: $scope.rdf.selectedProperties
        literals: $scope.rdf.propertyLiteralSelection
        literalTypes: $scope.rdf.propertyLiteralTypes
      
      $scope.currentMapping = $scope.sml.toSml mapping
      w = $window.open ''
      w.document.open()
      w.document.write '<pre>' + $scope.currentMapping + '</pre>'
      w.document.close()

    $scope.publish = () ->
      $scope.publishing = true
      mapping =
        tables: $scope.rdb.selectedTables()
        columns: $scope.rdb.selectedColumns()
        baseUri: $scope.rdf.baseUri
        subjectTemplate: $scope.rdf.subjectTemplate
        classes: $scope.rdf.selectedClasses
        properties: $scope.rdf.selectedProperties
        literals: $scope.rdf.propertyLiteralSelection
        literalTypes: $scope.rdf.propertyLiteralTypes

      $scope.publishing = false
      $scope.success = true
      $scope.currentMapping = $scope.sml.toSml mapping
      # $scope.transform.publish $scope.currentMapping
{'fraction_non_alphanumeric': 0.11871932694554803, 'fraction_numerical': 0.0, 'mean_word_length': 2.5875943000838224, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '6186339', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1267, 'n_words': 223}