<commit_before>/* Loading this file dynamically creates a popup dialog showing the
 * media library for file selection (single file selection only at
 * this time) inside an iframe.
 *
 * To invoke the popup, call the browseMediaLibrary function with the
 * following arguments:
 *
 *  1. Callback function: The function that will be called after the
 * popup is closed. The function will be called with a single
 * argument, which will be:
 *
 *     + null: if no selection was made (e.g. dialog closed by hitting
 * ESC), or
 *
 *     + the path of the selected file
 *
 *  2. Type of files that are selectable. Optional, defaults to image.
 *
 * The page that loads this script needs to load the following
 * resources:
 *
 *  1. css: filebrowser/css/smoothness/jquery-ui-1.9.1.custom.min.css
 *  2. js:  mezzanine/js/%s' % settings.JQUERY_FILENAME
 *  3. js:  filebrowser/js/jquery-ui-1.9.1.custom.min.js
 *  4. js:  filebrowser/js/filebrowser-popup.js (this script)
 *
 * Please keep in mind that jQuery UI dialog imposes z-index which isn't
 * always correctly calculated so it might need to be manually overridden
 * in the CSS. This happens with Mezzanine's inline editing for instance,
 * where exposeMask has bigger z-index than the dialog.
**/

var browseMediaLibrary;

$(function() {
	'use strict'

	var iframe = $(''),
		gallery = $('

').append(iframe).appendTo('body')
			.dialog({
				autoOpen: false,
				title: 'Media Library',
				width: 920,
				dialogClass: 'media-library'
			});

	browseMediaLibrary = function (callback, type) {
		var url = null;

		// type defaults to image
		type = (typeof type !== 'undefined') ? type : 'image';
		iframe.attr('src', window.__filebrowser_url + '?pop=4&type=' + type);

		gallery.dialog('open');

		gallery.on('dialogclose', function() {
			// Make sure to unload the iframe
			iframe.attr('src', '');
			callback(url);
		});

		// Binding must wait until iframe's content is completely loaded.
		iframe.on('load', function() {
			// This will work as long as both parent window and
			// iframe src are on the same domain.
			$(iframe.get(0).contentWindow.document)
				.find('.fb_selectlink')
				.click(function(e) {
					e.preventDefault();
					url = $(this).attr('rel');
					gallery.dialog('close');
			});
		});

		return true; // tell the editor that we'll take care of getting the image url
	};
});
<commit_msg>Further refactoring of filebrowser-popup.js<commit_after>/* Loading this file dynamically creates a popup dialog showing the
 * media library for file selection (single file selection only at
 * this time) inside an iframe.
 *
 * To invoke the popup, call the mediaLibrary.open function with the
 * following arguments:
 *
 *  1. Callback function: The function that will be called after the
 * popup is closed. The function will be called with a single
 * argument, which will be:
 *
 *     + null: if no selection was made (e.g. dialog closed by hitting
 * ESC), or
 *
 *     + the path of the selected file
 *
 *  2. Type of files that are selectable. Optional, defaults to image.
 *
 * The page that loads this script needs to load the following
 * resources:
 *
 *  1. css: filebrowser/css/smoothness/jquery-ui-1.9.1.custom.min.css
 *  2. js:  mezzanine/js/%s' % settings.JQUERY_FILENAME
 *  3. js:  filebrowser/js/jquery-ui-1.9.1.custom.min.js
 *  4. js:  filebrowser/js/filebrowser-popup.js (this script)
 *
 * Please keep in mind that jQuery UI dialog imposes z-index which isn't
 * always correctly calculated so it might need to be manually overridden
 * in the CSS. This happens with Mezzanine's inline editing for instance,
 * where exposeMask has bigger z-index than the dialog.
**/

var mediaLibrary = {
	iframe: null,
	gallery: null,

	init: function() {
		this.iframe = $('');
		this.gallery = $('

').append(this.iframe).appendTo('body')
			.dialog({
				autoOpen: false,
				title: 'Media Library',
				width: 920,
				dialogClass: 'media-library'
			});
	},

	open: function(callback, type) {
		var url = null,
			iframe = mediaLibrary.iframe,
			gallery = mediaLibrary.gallery;

		// type defaults to image
		type = (typeof type !== 'undefined') ? type : 'image';
		iframe.attr('src', window.__filebrowser_url + '?pop=4&type=' + type);

		gallery.dialog('open');

		gallery.on('dialogclose', function() {
			// Make sure to unload the iframe
			iframe.attr('src', '');
			// Certain editors (e.g. pagedown) require this callback to be
			// asynchronous.
			setTimeout(function() {
				callback(url);
			}, 1);
		});

		// Binding must wait until iframe's content is completely loaded.
		iframe.on('load', function() {
			// This will work as long as both parent window and
			// iframe src are on the same domain.
			$(iframe.get(0).contentWindow.document)
				.find('.fb_selectlink')
				.click(function(e) {
					e.preventDefault();
					url = $(this).attr('rel');
					gallery.dialog('close');
			});
		});

		return true; // tell the editor that we'll take care of getting the image url
	}
};

// Compatibility for libraries that depend on old non-namespaced function
var browseMediaLibrary = mediaLibrary.open;

$(function() {
   mediaLibrary.init();
});
<|endoftext|>


<commit_before>;(function ($, window, document) {
    'use strict';

  // SORTABLE TABLE CLASS DEFINITION
  // ===============================

  var SortableTable = function ($sortedTable, $navigation) {
    this.$sortedTable = $sortedTable;
    this.$navigation = $navigation;
    if ($navigation) {
      this.colCount = $sortedTable.find('tr')[0].childElementCount;
    }
  };

  SortableTable.prototype.sort = function ($sortedTh, sortDir) {
    var newSortGroup, sortGroup, rowCounter, rowsLength, navigationHtml = '', tableHtml = '', row, isNavigationCol, rows;
    var isSortedAsc = $sortedTh.hasClass('sorting-asc');

    this.$sortedTable
      .trigger('sort.sui.sortableTable')
      .find('th')
      .removeClass('sorting-asc')
      .removeClass('sorting-desc');

    if (isSortedAsc || sortDir === 'desc') {
      sortDir = 'desc';
      $sortedTh.addClass('sorting-desc');
    } else {
      $sortedTh.addClass('sorting-asc');
    }

    rows = this.$sortedTable
      .find('tbody tr')
      .toArray()
      .sort(this.comparer($sortedTh.index(), sortDir));

    isNavigationCol = this.$navigation && typeof $(rows[0]).children('td').eq($sortedTh.index()).data('sort-group') !== 'undefined';
    tableHtml = '
' + this.$sortedTable.find('thead:eq(0)').html() + '
';
    navigationHtml = '';

    rowsLength = rows.length;
    for (rowCounter = 0; rowCounter < rowsLength; rowCounter++) {
      row = rows[rowCounter];
      if (isNavigationCol) {
        sortGroup = $(row)
          .children('td')
          .eq($sortedTh.index())
          .data('sort-group');

        if (newSortGroup !== sortGroup) {
          newSortGroup = sortGroup;
          navigationHtml += '
' + sortGroup + '
';
          tableHtml += '

' +
            '
' + newSortGroup + '
' +
            '

';
        }
      }
      tableHtml += row.outerHTML;
    }

    if (this.$navigation) {
      if (isNavigationCol) {
        navigationHtml = '
' + navigationHtml + '
';
      }
      this.$navigation.html(navigationHtml);
    }

    this.$sortedTable.html(tableHtml + '
');
    this.$sortedTable.trigger('sorted.sui.sortableTable');
  };

  SortableTable.prototype.comparer = function(index, sortDir) {
    return function(a, b) {
      var result, valA, valB;
      var getCellValue = function(row, index) {
        var cell = $(row).children('td').eq(index);
        if (cell.attr('data-sort-value')){
          return cell.attr('data-sort-value');
        } else {
          return cell.text();
        }
      };

      valA = getCellValue(a, index);
      valB = getCellValue(b, index);
      if ($.isNumeric(valA) && $.isNumeric(valB)) {
        result = valA - valB;
      } else {
        result = valA.localeCompare(valB);
      }

      return sortDir === 'desc' ? result * -1 : result;
    };
  };

  // SORTABLE TABLE PLUGIN DEFINITION
  // ================================

  function Plugin(options) {
    return this.each(function () {
      var $navigation;
      var $this = $(this);
      var data = $this.data('sui.sortableTable');

      if (!data) {
        $navigation = options && ('navigation' in options) && options.navigation ? $(options.navigation) : false;
        $this.data('sui.sortableTable', (data = new SortableTable($this, $navigation)));
      }
      data.sort(options['sorted-th'], options['sort-direction']);
    });
  }

  var old = $.fn.sortableTable;

  $.fn.sortableTable = Plugin;
  $.fn.sortableTable.Constructor = SortableTable;

  // SORTABLE TABLE NO CONFLICT
  // ==========================

  $.fn.sortableTable.noConflict = function () {
    $.fn.sortableTable = old;
    return this;
  };

  // SORTABLE TABLE DATA-API
  // =======================

  (function(Plugin, $, window, document) {
    var callPlugin = function($this) {
      var $sortedTable = $this.closest('table');
      Plugin.call($sortedTable, {
        'sorted-th': $this,
        'navigation': $($sortedTable.data('sort-navigation'))
      });
    };

    $(document).on('click.sui.sortableTable.data-api', 'th[data-toggle=sort]', function() {
      callPlugin($(this));
    });

    $(document).on('keydown.sui.sortableTable.data-api', 'th[data-toggle=sort]', function(e) {
      if (e.keyCode === 13 || e.keyCode === 32) { //enter or space
        callPlugin($(this));
      }
    });

    // We have to use $(winodow).load() as $(document).ready() can not be triggered manually
    // and thus it would make it impossible to test this part of the code.
    $(window).load(function() {
      var $sortedTh = $('th[data-sort-onload]');
      var $sortedTable = $sortedTh.closest('table');
      Plugin.call($sortedTable, {
        'sorted-th': $sortedTh,
        'navigation': $($sortedTable.data('sort-navigation')),
        'sort-direction': $sortedTh.data('sort-onload')
      });
    });
  }(Plugin, $, window, document));

}(jQuery, window, document));
<commit_msg>Improve code readability<commit_after>;(function ($, window, document) {
    'use strict';

  // SORTABLE TABLE CLASS DEFINITION
  // ===============================

  var SortableTable = function ($sortedTable, $navigation) {
    this.$sortedTable = $sortedTable;
    this.$navigation = $navigation;
    if ($navigation) {
      this.colCount = $sortedTable.find('tr')[0].childElementCount;
    }
  };

  SortableTable.prototype.sort = function ($sortedTh, sortDir) {
    var sortGroup, rowCounter, rowsLength, tableHtml, row, isNavigationCol, rows;
    var newSortGroup = null;
    var navigationHtml = '';
    var isSortedAsc = $sortedTh.hasClass('sorting-asc');

    this.$sortedTable
      .trigger('sort.sui.sortableTable')
      .find('th')
      .removeClass('sorting-asc')
      .removeClass('sorting-desc');

    if (isSortedAsc || sortDir === 'desc') {
      sortDir = 'desc';
      $sortedTh.addClass('sorting-desc');
    } else {
      $sortedTh.addClass('sorting-asc');
    }

    rows = this.$sortedTable
      .find('tbody tr')
      .toArray()
      .sort(this.comparer($sortedTh.index(), sortDir));

    isNavigationCol = this.$navigation && typeof $(rows[0]).children('td').eq($sortedTh.index()).data('sort-group') !== 'undefined';
    tableHtml = '
' + this.$sortedTable.find('thead:eq(0)').html() + '
';

    rowsLength = rows.length;
    for (rowCounter = 0; rowCounter < rowsLength; rowCounter++) {
      row = rows[rowCounter];
      if (isNavigationCol) {
        sortGroup = $(row)
          .children('td')
          .eq($sortedTh.index())
          .data('sort-group');

        if (newSortGroup !== sortGroup) {
          newSortGroup = sortGroup;
          navigationHtml += '
' + sortGroup + '
';
          tableHtml += '

' +
            '
' + newSortGroup + '
' +
            '

';
        }
      }
      tableHtml += row.outerHTML;
    }

    if (this.$navigation) {
      if (isNavigationCol) {
        navigationHtml = '
' + navigationHtml + '
';
      }
      this.$navigation.html(navigationHtml);
    }

    this.$sortedTable.html(tableHtml + '
');
    this.$sortedTable.trigger('sorted.sui.sortableTable');
  };

  SortableTable.prototype.comparer = function(index, sortDir) {
    return function(a, b) {
      var result, valA, valB;
      var getCellValue = function(row, index) {
        var cell = $(row).children('td').eq(index);
        if (cell.attr('data-sort-value')){
          return cell.attr('data-sort-value');
        } else {
          return cell.text();
        }
      };

      valA = getCellValue(a, index);
      valB = getCellValue(b, index);
      if ($.isNumeric(valA) && $.isNumeric(valB)) {
        result = valA - valB;
      } else {
        result = valA.localeCompare(valB);
      }

      return sortDir === 'desc' ? result * -1 : result;
    };
  };

  // SORTABLE TABLE PLUGIN DEFINITION
  // ================================

  function Plugin(options) {
    return this.each(function () {
      var $navigation;
      var $this = $(this);
      var data = $this.data('sui.sortableTable');

      if (!data) {
        $navigation = options && ('navigation' in options) && options.navigation ? $(options.navigation) : false;
        $this.data('sui.sortableTable', (data = new SortableTable($this, $navigation)));
      }
      data.sort(options['sorted-th'], options['sort-direction']);
    });
  }

  var old = $.fn.sortableTable;

  $.fn.sortableTable = Plugin;
  $.fn.sortableTable.Constructor = SortableTable;

  // SORTABLE TABLE NO CONFLICT
  // ==========================

  $.fn.sortableTable.noConflict = function () {
    $.fn.sortableTable = old;
    return this;
  };

  // SORTABLE TABLE DATA-API
  // =======================

  (function(Plugin, $, window, document) {
    var callPlugin = function($this) {
      var $sortedTable = $this.closest('table');
      Plugin.call($sortedTable, {
        'sorted-th': $this,
        'navigation': $($sortedTable.data('sort-navigation'))
      });
    };

    $(document).on('click.sui.sortableTable.data-api', 'th[data-toggle=sort]', function() {
      callPlugin($(this));
    });

    $(document).on('keydown.sui.sortableTable.data-api', 'th[data-toggle=sort]', function(e) {
      if (e.keyCode === 13 || e.keyCode === 32) { //enter or space
        callPlugin($(this));
      }
    });

    // We have to use $(winodow).load() as $(document).ready() can not be triggered manually
    // and thus it would make it impossible to test this part of the code.
    $(window).load(function() {
      var $sortedTh = $('th[data-sort-onload]');
      var $sortedTable = $sortedTh.closest('table');
      Plugin.call($sortedTable, {
        'sorted-th': $sortedTh,
        'navigation': $($sortedTable.data('sort-navigation')),
        'sort-direction': $sortedTh.data('sort-onload')
      });
    });
  }(Plugin, $, window, document));

}(jQuery, window, document));
<|endoftext|>


<commit_before>import {Gauge} from 'widget/gauge'
import {msg} from 'translate'
import React from 'react'
import Tooltip from 'widget/tooltip'
import styles from './userResourceUsage.module.css'

export const UserResourceUsage = ({currentValue, budgetValue, formattedValue}) => {
    const usage = Math.min(currentValue / budgetValue, 1)
    return (
        <Tooltip
            // className={[overbudget ? styles.overBudget : null].join(' ')}
            msg={
                <Gauge
                    value={currentValue}
                    maxValue={budgetValue}
                    infoTop={({percentage}) => msg('user.report.usage', {percentage})}
                />
            }
            delay={250}
            placement='topRight'>
            <div className={styles.usage} style={{'--usage': `${usage}`}}>
                {formattedValue}

        </Tooltip>
    )
}
<commit_msg>Protected against division by zero.<commit_after>import {Gauge} from 'widget/gauge'
import {msg} from 'translate'
import React from 'react'
import Tooltip from 'widget/tooltip'
import styles from './userResourceUsage.module.css'

export const UserResourceUsage = ({currentValue = 0, budgetValue = 0, formattedValue}) =>
    budgetValue > 0
        ? (
            <Tooltip
                msg={
                    <Gauge
                        value={currentValue}
                        maxValue={budgetValue}
                        infoTop={({percentage}) => msg('user.report.usage', {percentage})}
                    />
                }
                delay={250}
                placement='topRight'>
                <div className={styles.usage} style={{'--usage': `${Math.min(currentValue / budgetValue, 1)}`}}>
                    {formattedValue}

            </Tooltip>
        )
        : null
<|endoftext|>


<commit_before>'use strict';

/*!
 * Snakeskin
 * https://github.com/SnakeskinTpl/Snakeskin
 *
 * Released under the MIT license
 * https://github.com/SnakeskinTpl/Snakeskin/blob/master/LICENSE
 */

// jscs:disable
const
	$C = require('collection.js').$C;

const
	gulp = require('gulp'),
	async = require('async'),
	del = require('del'),
	helpers = require('./helpers');

const
	rollup = require('gulp-rollup'),
	monic = require('gulp-monic'),
	babel = require('rollup-plugin-babel'),
	replace = require('gulp-replace'),
	rename = require('gulp-rename'),
	header = require('gulp-header'),
	eol = require('gulp-eol');

gulp.task('build', (cb) => {
	const
		builds = helpers.getBuilds(),
		tasks = [];

	$C(builds).forEach((el, key) => {
		const name = `${key}.tmp`;
		const fullHead =
			helpers.getHead(true, key !== 'snakeskin' ? key.replace(/^snakeskin\./, '') : '') +
			' *\n' +
			` * Date: '${new Date().toUTCString()}\n` +
			' */\n\n';

		tasks.push((cb) => {
			gulp.src('./src/index.js')
				.pipe(monic({flags: el}))
				.on('error', helpers.error(cb))
				.pipe(rename(name))
				.pipe(gulp.dest('./src'))
				.on('end', buildSrc);

			function buildSrc() {
				gulp.src(`./src/${name}`)
					.pipe(rollup({
						format: 'umd',
						moduleId: 'Snakeskin',
						moduleName: 'Snakeskin',
						plugins: [babel()]
					}))

					.on('error', helpers.error(cb))
					.pipe(replace(/(@param {.*?}) \[([$\w.]+)=.*]/g, '$1 $2'))
					.pipe(replace(headRgxp.addFlag('g'), ''))
					.pipe(header(fullHead))
					.pipe(eol('\n'))
					.pipe(rename({extname: '.js'}))
					.pipe(gulp.dest('./dist'))
					.on('end', clean);
			}

			function clean() {
				del(`./src/${name}`, cb);
			}
		});
	});

	async.parallel(tasks, cb);
});
<commit_msg>Updated del<commit_after>'use strict';

/*!
 * Snakeskin
 * https://github.com/SnakeskinTpl/Snakeskin
 *
 * Released under the MIT license
 * https://github.com/SnakeskinTpl/Snakeskin/blob/master/LICENSE
 */

// jscs:disable
const
	$C = require('collection.js').$C;

const
	gulp = require('gulp'),
	async = require('async'),
	del = require('del'),
	helpers = require('./helpers');

const
	rollup = require('gulp-rollup'),
	monic = require('gulp-monic'),
	babel = require('rollup-plugin-babel'),
	replace = require('gulp-replace'),
	rename = require('gulp-rename'),
	header = require('gulp-header'),
	eol = require('gulp-eol');

gulp.task('build', (cb) => {
	const
		builds = helpers.getBuilds(),
		tasks = [];

	$C(builds).forEach((el, key) => {
		const name = `${key}.tmp`;
		const fullHead =
			helpers.getHead(true, key !== 'snakeskin' ? key.replace(/^snakeskin\./, '') : '') +
			' *\n' +
			` * Date: '${new Date().toUTCString()}\n` +
			' */\n\n';

		tasks.push((cb) => {
			gulp.src('./src/index.js')
				.pipe(monic({flags: el}))
				.on('error', helpers.error(cb))
				.pipe(rename(name))
				.pipe(gulp.dest('./src'))
				.on('end', buildSrc);

			function buildSrc() {
				gulp.src(`./src/${name}`)
					.pipe(rollup({
						format: 'umd',
						moduleName: 'Snakeskin',
						plugins: [babel()]
					}))

					.on('error', helpers.error(cb))
					.pipe(replace(/(@param {.*?}) \[([$\w.]+)=.*]/g, '$1 $2'))
					.pipe(replace(headRgxp.addFlag('g'), ''))
					.pipe(header(fullHead))
					.pipe(eol('\n'))
					.pipe(rename({extname: '.js'}))
					.pipe(gulp.dest('./dist'))
					.on('end', clean);
			}

			function clean() {
				del(`./src/${name}`).then(cb);
			}
		});
	});

	async.parallel(tasks, cb);
});
<|endoftext|>


<commit_before><commit_msg>Resolvendo o problema de login sem email<commit_after><|endoftext|>


<commit_before>/**
 * Builds the query that retrieve the list of all classifications.
 */
const classifications = () => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT ?classification ?code ?label WHERE {
    ?classification rdf:type skos:ConceptScheme ; skos:notation ?code ; skos:prefLabel ?label .
    FILTER ( langMatches(lang(?label), "EN"))
  } ORDER BY ?label

 `

/**
 * Builds the query that gets the details about a classification.
 */
 //TODO @Franck workaround the fact the DB is not returning any line otherwise
const classificationDetails = uri => `
  PREFIX dcterms: <http://purl.org/dc/terms/>
  PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
  SELECT ?code ?label ?issued WHERE {
    <${uri}> skos:notation ?code ; skos:prefLabel ?label ; dcterms:issued ?issued .
    FILTER ( langMatches(lang(?label), "EN"))
  }
`

/**
 * Builds the query that gets the levels of a classification.
 * Using SPARQL 1.1 property paths, see https://www.w3.org/TR/sparql11-query/#propertypaths
 */
const classificationLevels = uri => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
  SELECT ?level ?depth ?label
  WHERE {
    <${uri}> xkos:levels/rdf:rest*/rdf:first ?level .
    ?level xkos:depth ?depth ; skos:prefLabel ?label .
    FILTER (langMatches(lang(?label), "EN"))
  } ORDER BY ?depth
`
/**
 * Builds the query that gets the correspondence tables for a given classification.
 * TODO Improve the database, all tables don't have a label.
 */
const classificationCorrespondences = uri => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
  SELECT ?table ?definition ?code WHERE {
    ?table xkos:compares <${uri}> ;
           skos:definition ?definition
    OPTIONAL {
      ?table skos:notation ?code
    }
    # We miss somme correspondences where there is no definition in english
    FILTER (langMatches(lang(?definition), "EN") || lang(?definition)="")
  }
`

/**
 * Builds the query that gets all the correspondence tables.
 * TODO Improve the database, all tables don't have a label.
 */
const correspondences = uri => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
  SELECT ?table ?label WHERE {
    ?table rdf:type xkos:Corresponce .
    OPTIONAL {
      ?table skos:prefLabel ?label
      FILTER (langMatches(lang(?label), "EN"))
    }
  }
`

/**
 * Builds the query that gets the list of items of a given level.
 */
const levelItems = uri => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT ?item ?code ?label WHERE {
    <${uri}> skos:member ?item .
    ?item skos:notation ?code ; skos:prefLabel ?label .
    FILTER (langMatches(lang(?label), "EN"))
  } ORDER BY ?code
`

/**
 * Builds the query that gets the list of items of a given level.
 */
const classificationItems = uri => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT ?item ?code ?label WHERE {
    <${uri}> xkos:levels/rdf:rest*/rdf:first ?level .
    ?level skos:member ?item .
    ?item skos:notation ?code ; skos:prefLabel ?label .
    FILTER ( langMatches(lang(?label), "EN"))
  } ORDER BY ?code LIMIT 25
`

const itemDetails = item => `
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
  SELECT ?label ?code ?label ?text ?cl ?clCode ?clLabel ?parent ?parentCode
      ?parentLabel {
    <${item}> skos:prefLabel ?label ;
              skos:notation ?code ;
              skos:inScheme ?cl .
    ?cl skos:prefLabel ?clLabel

    OPTIONAL {
      ?cl skos:notation ?clCode .
    }

    OPTIONAL {
      <${item}> skos:broader ?parent .
        ?parent skos:prefLabel ?parentLabel .
      OPTIONAL { ?parent skos:notation ?parentCode . }
      FILTER ( langMatches(lang(?parentLabel), "EN"))
    }

    # if we use only one OPTIONAL keyword, we will not receive the note
    # if there is no parent
    OPTIONAL {
     <${item}> xkos:coreContentNote ?content .
     ?content xkos:plainText ?text .
     FILTER ( langMatches(lang(?content), "EN"))
    }
    FILTER (
      # langMatches(lang(?label), "EN") &&
      # langMatches(lang(?clLabel), "EN"))
      # HACK english label missing http://classification-explorer.noknot.fr/classification/nafr2/sousClasse/23_69Z
      langMatches(lang(?label), "EN"))
  }
`

const itemChildren = item => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT ?item ?code ?label {
    <${item}> skos:narrower ?item .
    ?item skos:notation ?code .
    ?item skos:prefLabel ?label
    FILTER (langMatches(lang(?label), "EN"))
  } ORDER BY ?code
`

const correspondenceAssociations = correspondence => `
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xkos: <http://rdf-vocabulary.ddialliance.org/xkos#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT
  ?association
  ?comment
  ?source ?sourceCode ?sourceLabel
  ?target ?targetCode ?targetLabel
WHERE {
  <${correspondence}> xkos:madeOf ?association .
  ?association xkos:sourceConcept ?source ;
               xkos:targetConcept ?target .
  OPTIONAL {
    ?association rdfs:comment ?comment
  }
  OPTIONAL {
    ?source skos:notation ?sourceCode ;
            skos:prefLabel ?sourceLabel .
    FILTER (langMatches(lang(?sourceLabel), "EN"))
  }
  OPTIONAL {
    ?target skos:notation ?targetCode ;
            skos:prefLabel ?targetLabel
    FILTER (langMatches(lang(?targetLabel), "EN"))
  }
}
ORDER BY ?sourceCode
`

const itemCorrespondences = hash => {
  const  [item, correspondenceTable] = hash.split('||');
  return `
    PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
    SELECT ?association ?item ?code ?label {
    {
    <${correspondenceTable}> xkos:madeOf ?association .
  ?association xkos:sourceConcept <${item}> ;
               xkos:targetConcept ?item .
               ?item skos:notation ?code .
               ?item skos:prefLabel ?label
               FILTER (langMatches(lang(?label), "EN"))
    }
    UNION {

  <${correspondenceTable}> xkos:madeOf ?association .
  ?association xkos:targetConcept <${item}> ;
               xkos:sourceConcept ?item .
               ?item skos:notation ?code .
               ?item skos:prefLabel ?label
               FILTER (langMatches(lang(?label), "EN"))

  }
  }
  `
}

//HACK For now, the database provides information about the classifications
//being compared, but no information about which classification acts as the
//source, and which acts as the target. This information is retrieved by valuing
//one assocaition
// const correspondenceDetails = correspondence => `
//   PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
//   PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
//   SELECT ?classification ?code ?label {
//     <${correspondence}> xkos:compares ?classification .
//     ?classification skos:prefLabel ?label ;
//                     skos:notation ?code
//   }
// `
const correspondenceDetails = correspondence => `
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>

  SELECT
    ?source ?sourceCode ?sourceLabel
    ?target ?targetCode ?targetLabel {
    <${correspondence}> xkos:madeOf ?association .
    ?association xkos:sourceConcept ?sourceItem ;
                 xkos:targetConcept ?targetItem .
    ?sourceItem skos:inScheme ?source .
    ?targetItem skos:inScheme ?target .
    ?source skos:prefLabel ?sourceLabel ;
                    skos:notation ?sourceCode .
    ?target skos:prefLabel ?targetLabel ;
                    skos:notation ?targetCode .
  }
  LIMIT 1
`

const searchEverything = keyword => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT DISTINCT ?subject ?predicate ?match ?score WHERE {
    ?subject ?predicate ?match .
    (?match ?score) <tag:stardog:api:property:textMatch> '${keyword}*'.
  }
`

const searchItems = hash => {
  const  [keyword, searchForCode] = hash.split('||');
  if(searchForCode==='true'){
    return  `
    PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
    PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
    SELECT DISTINCT
      ?item ?code ?itemLabel
      ?classification ?classificationLabel ?coreContentNoteText ?additionalContentNoteText
    WHERE {
      ?item skos:inScheme ?classification ;
            skos:notation ?code ;
            skos:prefLabel ?itemLabel .
      ?classification skos:prefLabel ?classificationLabel .
      FILTER regex(?code, "${keyword}", "i")
    } order by ?code
    `
  }else{

  return  `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT DISTINCT
    ?item ?code ?itemLabel
    ?classification ?classificationLabel ?coreContentNoteText ?additionalContentNoteText
  WHERE {
    ?item skos:inScheme ?classification ;
          skos:notation ?code ;
          skos:prefLabel ?itemLabel ;
          xkos:coreContentNote ?coreContentNote ;
          xkos:additionalContentNote ?additionalContentNote .
    ?coreContentNote xkos:plainText ?coreContentNoteText .
    ?additionalContentNote   xkos:plainText ?additionalContentNoteText .
    ?classification skos:prefLabel ?classificationLabel .

    FILTER ( langMatches(lang(?itemLabel), "EN") &&
    (
      regex(?code, "${keyword}", "i") ||
      regex(?itemLabel, "${keyword}", "i") ||
      regex(?coreContentNoteText, "${keyword}", "i") ||
      regex(?additionalContentNoteText, "${keyword}", "i") ||
      regex(?classificationLabel, "${keyword}", "i")
    ))
  } order by ?code
`}
}

export default {
  correspondenceAssociations,
  classifications,
  classificationDetails,
  classificationItems,
  classificationLevels,
  classificationCorrespondences,
  correspondences,
  levelItems,
  itemCorrespondences,
  itemDetails,
  itemChildren,
  correspondenceDetails,
  searchEverything,
  searchItems
}
<commit_msg>Hack to make missing english version of note missing appear<commit_after>/**
 * Builds the query that retrieve the list of all classifications.
 */
const classifications = () => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT ?classification ?code ?label WHERE {
    ?classification rdf:type skos:ConceptScheme ; skos:notation ?code ; skos:prefLabel ?label .
    FILTER ( langMatches(lang(?label), "EN"))
  } ORDER BY ?label

 `

/**
 * Builds the query that gets the details about a classification.
 */
 //TODO @Franck workaround the fact the DB is not returning any line otherwise
const classificationDetails = uri => `
  PREFIX dcterms: <http://purl.org/dc/terms/>
  PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
  SELECT ?code ?label ?issued WHERE {
    <${uri}> skos:notation ?code ; skos:prefLabel ?label ; dcterms:issued ?issued .
    FILTER ( langMatches(lang(?label), "EN"))
  }
`

/**
 * Builds the query that gets the levels of a classification.
 * Using SPARQL 1.1 property paths, see https://www.w3.org/TR/sparql11-query/#propertypaths
 */
const classificationLevels = uri => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
  SELECT ?level ?depth ?label
  WHERE {
    <${uri}> xkos:levels/rdf:rest*/rdf:first ?level .
    ?level xkos:depth ?depth ; skos:prefLabel ?label .
    FILTER (langMatches(lang(?label), "EN"))
  } ORDER BY ?depth
`
/**
 * Builds the query that gets the correspondence tables for a given classification.
 * TODO Improve the database, all tables don't have a label.
 */
const classificationCorrespondences = uri => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
  SELECT ?table ?definition ?code WHERE {
    ?table xkos:compares <${uri}> ;
           skos:definition ?definition
    OPTIONAL {
      ?table skos:notation ?code
    }
    # We miss somme correspondences where there is no definition in english
    FILTER (langMatches(lang(?definition), "EN") || lang(?definition)="")
  }
`

/**
 * Builds the query that gets all the correspondence tables.
 * TODO Improve the database, all tables don't have a label.
 */
const correspondences = uri => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
  SELECT ?table ?label WHERE {
    ?table rdf:type xkos:Corresponce .
    OPTIONAL {
      ?table skos:prefLabel ?label
      FILTER (langMatches(lang(?label), "EN"))
    }
  }
`

/**
 * Builds the query that gets the list of items of a given level.
 */
const levelItems = uri => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT ?item ?code ?label WHERE {
    <${uri}> skos:member ?item .
    ?item skos:notation ?code ; skos:prefLabel ?label .
    FILTER (langMatches(lang(?label), "EN"))
  } ORDER BY ?code
`

/**
 * Builds the query that gets the list of items of a given level.
 */
const classificationItems = uri => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT ?item ?code ?label WHERE {
    <${uri}> xkos:levels/rdf:rest*/rdf:first ?level .
    ?level skos:member ?item .
    ?item skos:notation ?code ; skos:prefLabel ?label .
    FILTER ( langMatches(lang(?label), "EN"))
  } ORDER BY ?code LIMIT 25
`

const itemDetails = item => `
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
  SELECT ?label ?code ?label ?text ?cl ?clCode ?clLabel ?parent ?parentCode
      ?parentLabel {
    <${item}> skos:prefLabel ?label ;
              skos:notation ?code ;
              skos:inScheme ?cl .
    ?cl skos:prefLabel ?clLabel

    OPTIONAL {
      ?cl skos:notation ?clCode .
    }

    OPTIONAL {
      <${item}> skos:broader ?parent .
        ?parent skos:prefLabel ?parentLabel .
      OPTIONAL { ?parent skos:notation ?parentCode . }
      FILTER ( langMatches(lang(?parentLabel), "EN"))
    }

    # if we use only one OPTIONAL keyword, we will not receive the note
    # if there is no parent
    OPTIONAL {
     <${item}> xkos:coreContentNote ?content .
     ?content xkos:plainText ?text .
     # HACK see #46
     # FILTER ( langMatches(lang(?content), "EN"))
    }
    FILTER (
      # langMatches(lang(?label), "EN") &&
      # langMatches(lang(?clLabel), "EN"))
      # HACK english label missing (see #45)
      # http://classification-explorer.noknot.fr/classification/nafr2/sousClasse/23_69Z
      langMatches(lang(?label), "EN"))
  }
`

const itemChildren = item => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT ?item ?code ?label {
    <${item}> skos:narrower ?item .
    ?item skos:notation ?code .
    ?item skos:prefLabel ?label
    FILTER (langMatches(lang(?label), "EN"))
  } ORDER BY ?code
`

const correspondenceAssociations = correspondence => `
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xkos: <http://rdf-vocabulary.ddialliance.org/xkos#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT
  ?association
  ?comment
  ?source ?sourceCode ?sourceLabel
  ?target ?targetCode ?targetLabel
WHERE {
  <${correspondence}> xkos:madeOf ?association .
  ?association xkos:sourceConcept ?source ;
               xkos:targetConcept ?target .
  OPTIONAL {
    ?association rdfs:comment ?comment
  }
  OPTIONAL {
    ?source skos:notation ?sourceCode ;
            skos:prefLabel ?sourceLabel .
    FILTER (langMatches(lang(?sourceLabel), "EN"))
  }
  OPTIONAL {
    ?target skos:notation ?targetCode ;
            skos:prefLabel ?targetLabel
    FILTER (langMatches(lang(?targetLabel), "EN"))
  }
}
ORDER BY ?sourceCode
`

const itemCorrespondences = hash => {
  const  [item, correspondenceTable] = hash.split('||');
  return `
    PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
    SELECT ?association ?item ?code ?label {
    {
    <${correspondenceTable}> xkos:madeOf ?association .
  ?association xkos:sourceConcept <${item}> ;
               xkos:targetConcept ?item .
               ?item skos:notation ?code .
               ?item skos:prefLabel ?label
               FILTER (langMatches(lang(?label), "EN"))
    }
    UNION {

  <${correspondenceTable}> xkos:madeOf ?association .
  ?association xkos:targetConcept <${item}> ;
               xkos:sourceConcept ?item .
               ?item skos:notation ?code .
               ?item skos:prefLabel ?label
               FILTER (langMatches(lang(?label), "EN"))

  }
  }
  `
}

//HACK For now, the database provides information about the classifications
//being compared, but no information about which classification acts as the
//source, and which acts as the target. This information is retrieved by valuing
//one assocaition
// const correspondenceDetails = correspondence => `
//   PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
//   PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
//   SELECT ?classification ?code ?label {
//     <${correspondence}> xkos:compares ?classification .
//     ?classification skos:prefLabel ?label ;
//                     skos:notation ?code
//   }
// `
const correspondenceDetails = correspondence => `
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>

  SELECT
    ?source ?sourceCode ?sourceLabel
    ?target ?targetCode ?targetLabel {
    <${correspondence}> xkos:madeOf ?association .
    ?association xkos:sourceConcept ?sourceItem ;
                 xkos:targetConcept ?targetItem .
    ?sourceItem skos:inScheme ?source .
    ?targetItem skos:inScheme ?target .
    ?source skos:prefLabel ?sourceLabel ;
                    skos:notation ?sourceCode .
    ?target skos:prefLabel ?targetLabel ;
                    skos:notation ?targetCode .
  }
  LIMIT 1
`

const searchEverything = keyword => `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT DISTINCT ?subject ?predicate ?match ?score WHERE {
    ?subject ?predicate ?match .
    (?match ?score) <tag:stardog:api:property:textMatch> '${keyword}*'.
  }
`

const searchItems = hash => {
  const  [keyword, searchForCode] = hash.split('||');
  if(searchForCode==='true'){
    return  `
    PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
    PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
    SELECT DISTINCT
      ?item ?code ?itemLabel
      ?classification ?classificationLabel ?coreContentNoteText ?additionalContentNoteText
    WHERE {
      ?item skos:inScheme ?classification ;
            skos:notation ?code ;
            skos:prefLabel ?itemLabel .
      ?classification skos:prefLabel ?classificationLabel .
      FILTER regex(?code, "${keyword}", "i")
    } order by ?code
    `
  }else{

  return  `
  PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  SELECT DISTINCT
    ?item ?code ?itemLabel
    ?classification ?classificationLabel ?coreContentNoteText ?additionalContentNoteText
  WHERE {
    ?item skos:inScheme ?classification ;
          skos:notation ?code ;
          skos:prefLabel ?itemLabel ;
          xkos:coreContentNote ?coreContentNote ;
          xkos:additionalContentNote ?additionalContentNote .
    ?coreContentNote xkos:plainText ?coreContentNoteText .
    ?additionalContentNote   xkos:plainText ?additionalContentNoteText .
    ?classification skos:prefLabel ?classificationLabel .

    FILTER ( langMatches(lang(?itemLabel), "EN") &&
    (
      regex(?code, "${keyword}", "i") ||
      regex(?itemLabel, "${keyword}", "i") ||
      regex(?coreContentNoteText, "${keyword}", "i") ||
      regex(?additionalContentNoteText, "${keyword}", "i") ||
      regex(?classificationLabel, "${keyword}", "i")
    ))
  } order by ?code
`}
}

export default {
  correspondenceAssociations,
  classifications,
  classificationDetails,
  classificationItems,
  classificationLevels,
  classificationCorrespondences,
  correspondences,
  levelItems,
  itemCorrespondences,
  itemDetails,
  itemChildren,
  correspondenceDetails,
  searchEverything,
  searchItems
}
<|endoftext|>


<commit_before>/*
 * Copyright 2012-2016 the Flamingo Community.
 *
 * 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.
 */
Ext.define('Flamingo.view.main.Main', {
    extend: 'Ext.container.Viewport',
    xtype: 'app-main',

    requires: [
        'Flamingo.view.main.MainController',
        'Flamingo.view.main.MainModel'
    ],

    controller: 'main',
    viewModel: 'main',

    layout: 'border',

    items: [{
        xtype: 'component',
        region: 'north',
        height: 80,
        cls: 'header',
        html: '

FLAMINGO

'
    },{
        xtype: 'dataview',
        region: 'west',
        bind: {
            store: '{menu}'
        },
        width: 260,
        cls: 'nav',
        itemSelector: 'li',
        tpl: [
            '
',
            '<tpl for=".">',
                '
{text}',
            '</tpl>',
            '
'
        ],
        listeners: {
            select: 'onSelect'
        }
    },{
        xtype: 'container',
        reference: 'mainContainer',
        region: 'center',
        flex: 1,
        layout: 'fit'
    },{
        xtype: 'component',
        region: 'south',
        height: 20
    }]

});
<commit_msg>FL-104 로고 수정<commit_after>/*
 * Copyright 2012-2016 the Flamingo Community.
 *
 * 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.
 */
Ext.define('Flamingo.view.main.Main', {
    extend: 'Ext.container.Viewport',
    xtype: 'app-main',

    requires: [
        'Flamingo.view.main.MainController',
        'Flamingo.view.main.MainModel'
    ],

    controller: 'main',
    viewModel: 'main',

    layout: 'border',

    items: [{
        xtype: 'component',
        region: 'north',
        height: 80,
        cls: 'header',
        html: '

'
    },{
        xtype: 'dataview',
        region: 'west',
        bind: {
            store: '{menu}'
        },
        width: 260,
        cls: 'nav',
        itemSelector: 'li',
        tpl: [
            '
',
            '<tpl for=".">',
                '
{text}',
            '</tpl>',
            '
'
        ],
        listeners: {
            select: 'onSelect'
        }
    },{
        xtype: 'container',
        reference: 'mainContainer',
        region: 'center',
        flex: 1,
        layout: 'fit'
    },{
        xtype: 'component',
        region: 'south',
        height: 20
    }]

});
<|endoftext|>


<commit_before>'use strict';

var lazyReq = require('lazy-req')(require);
var del = lazyReq('del');
var exec = require('child_process').exec;

module.exports = function (gulp, gutil) {
  gulp.task('clean-tmp', function () {
    return del()('.tmp', { force: true });
  });

  gulp.task('clean-dist', function () {
    return del()('dist', { force: true });
  });

  gulp.task('clean-plugin-zip', function () {
    return del()('plugin.lar', { force: true });
  });

  gulp.task('restructure', function (cb) {
    const gitCheckoutCmd = 'git checkout .';
    const bowerInstallCmd = 'cd angular-li && bower install';
    const dirsToDel = ['.tmp', 'plugin', 'res', 'web', 'bower_components', 'coverage', 'test-reports'];

    gutil.log('Delete unused or moved directories: ' + gutil.colors.cyan(`rm -rf ${dirsToDel}`));
    del()(dirsToDel, { force: true }).then(() => {
      gutil.log('Re-fetching "plugin" directory from git repo, ' +
        'make sure you do not have any local changes: ' + gutil.colors.cyan(gitCheckoutCmd));

      exec(gitCheckoutCmd, function (err) {
        if (err) {
          cb(err);
        }

        gutil.log('Installing bower components in angular-li sub dir: ' + gutil.colors.cyan(bowerInstallCmd));
        exec(bowerInstallCmd, function (err) {
          if (err) {
            cb(err);
          }
          gutil.log(gutil.colors.green('Restructure cleanup complete. Please run the ') + gutil.colors.cyan('gulp') +
            gutil.colors.green(' command from the root directory to start the angular-li env.'));
          cb();
        });
      });
    }).catch(err => {
      gutil.log(gutil.colors.red(err));
    });
  });

  gulp.task('clean', ['clean-tmp', 'clean-dist', 'clean-plugin-zip']);
};
<commit_msg>LIA-63593-delete-plugin-path-if-not-new-gutil-structure<commit_after>'use strict';

var lazyReq = require('lazy-req')(require);
var del = lazyReq('del');
var exec = require('child_process').exec;

module.exports = function (gulp, gutil) {
  gulp.task('clean-tmp', function () {
    return del()('.tmp', { force: true });
  });

  gulp.task('clean-dist', function () {
    var delPath = gutil.env.newStructure ? 'dist' : 'plugin';
    return del()(delPath, { force: true });
  });

  gulp.task('clean-plugin-zip', function () {
    return del()('plugin.lar', { force: true });
  });

  gulp.task('restructure', function (cb) {
    const gitCheckoutCmd = 'git checkout .';
    const bowerInstallCmd = 'cd angular-li && bower install';
    const dirsToDel = ['.tmp', 'plugin', 'res', 'web', 'bower_components', 'coverage', 'test-reports'];

    gutil.log('Delete unused or moved directories: ' + gutil.colors.cyan(`rm -rf ${dirsToDel}`));
    del()(dirsToDel, { force: true }).then(() => {
      gutil.log('Re-fetching "plugin" directory from git repo, ' +
        'make sure you do not have any local changes: ' + gutil.colors.cyan(gitCheckoutCmd));

      exec(gitCheckoutCmd, function (err) {
        if (err) {
          cb(err);
        }

        gutil.log('Installing bower components in angular-li sub dir: ' + gutil.colors.cyan(bowerInstallCmd));
        exec(bowerInstallCmd, function (err) {
          if (err) {
            cb(err);
          }
          gutil.log(gutil.colors.green('Restructure cleanup complete. Please run the ') + gutil.colors.cyan('gulp') +
            gutil.colors.green(' command from the root directory to start the angular-li env.'));
          cb();
        });
      });
    }).catch(err => {
      gutil.log(gutil.colors.red(err));
    });
  });

  gulp.task('clean', ['clean-tmp', 'clean-dist', 'clean-plugin-zip']);
};
<|endoftext|>


<commit_before>(function () {
    Editor.projectInfo = Editor.remote.projectInfo;

    // init engine-framework
    Editor.require('app://engine-framework');

    // init runtime
    var runtimeUrl = 'app://runtime/runtime-' + Editor.projectInfo.runtime + '/index.html';
    Polymer.Base.importHref( runtimeUrl, function ( event ) {
        // init asset library
        Fire.AssetLibrary.init('TODO');

        // init engine
        var canvasEL = document.getElementById('canvas');
        var bcr = document.body.getBoundingClientRect();

        //
        Fire.Engine.init({
            width: bcr.width,
            height: bcr.height,
            canvas: canvasEL,
        }, function ( err ) {
            // TODO:
        });

        window.onresize = function () {
            bcr = document.body.getBoundingClientRect();
            Fire.Engine.resize( bcr.width, bcr.height );
        };
    }, function ( err ) {
        Editor.error( 'Failed to load %s. message: %s', runtimeUrl, err.message );
    });
})();
<commit_msg>fix scene init not have correct library path<commit_after>(function () {
    Editor.projectInfo = Editor.remote.projectInfo;
    var libraryPath = Editor.remote.assetdb.library;

    // init engine-framework
    Editor.require('app://engine-framework');

    // init runtime
    var runtimeUrl = 'app://runtime/runtime-' + Editor.projectInfo.runtime + '/index.html';
    Polymer.Base.importHref( runtimeUrl, function ( event ) {
        // init asset library
        Fire.AssetLibrary.init(libraryPath);

        // init engine
        var canvasEL = document.getElementById('canvas');
        var bcr = document.body.getBoundingClientRect();

        //
        Fire.Engine.init({
            width: bcr.width,
            height: bcr.height,
            canvas: canvasEL,
        }, function ( err ) {
            // TODO:
        });

        window.onresize = function () {
            bcr = document.body.getBoundingClientRect();
            Fire.Engine.resize( bcr.width, bcr.height );
        };
    }, function ( err ) {
        Editor.error( 'Failed to load %s. message: %s', runtimeUrl, err.message );
    });
})();
<|endoftext|>


<commit_before>import {
  SKOSPrefix, ORGPrefix, GSBPMPrefix, GSIMPrefix, RDFSPrefix, CSPAPrefix
} from './prefixes'

// TODO we might need to filter on the language, but for now English seems to be
// the only language available

/**
 * Builds the query that retrieves the list of NSIs.
 */
const NSIList = () => `
  PREFIX org: <${ORGPrefix}>
  PREFIX skos: <${SKOSPrefix}>

  SELECT ?nsi ?label

  WHERE {
    ?nsi a org:Organization ; skos:prefLabel ?label .
  }
  ORDER BY ?nsi
 `

/**
 * Builds the query that retrieves the GSBPM overview.
 */
const GSBPMDescription = () => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>
  SELECT ?phase ?phaseLabel ?subprocess ?subprocessLabel ?phaseCode
         ?subprocessCode ?subprocessDefinition
  WHERE {
   ?phase a gsbpm:Phase ;
          skos:narrower ?subprocess ;
   OPTIONAL {
     ?phase skos:prefLabel ?phaseLabel
   }
   OPTIONAL {
     ?subprocess skos:prefLabel ?subprocessLabel
	 }
   OPTIONAL {
     ?subprocess skos:definition ?subprocessDefinition
   }
   OPTIONAL {
     ?phase skos:notation ?phaseCode
   }
   OPTIONAL {
     ?subprocess skos:notation ?subprocessCode
   }
  }
 `

 /**
  * Builds the query that retrieves the list of CSPA services.
  */
const services = () => `
  PREFIX cspa:  <${CSPAPrefix}>
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT distinct ?service ?label ?description
  WHERE {
    ?service a cspa:package .
    OPTIONAL {?service cspa:label ?label}
	  OPTIONAL {?service cspa:hasPackageDefinition [
    	   a cspa:ServiceDefinition; cspa:aimsAt [cspa:description ?description]]}
  }
`

/**
 * Builds the query that retrieves the details of a given CSPA service.
 */
const serviceDetails = service => `
  PREFIX cspa: <${CSPAPrefix}>
  PREFIX skos: <${SKOSPrefix}>

  SELECT
    ?label ?description ?outcomes ?subprocess ?restrictions ?graphName
    ?builderOrg
  WHERE {
    GRAPH ?graphName {
      <${service}>
        cspa:hasPackageDefinition [
    	     a cspa:ServiceDefinition; cspa:aimsAt [
             cspa:description ?description ;
    	        cspa:outcomes ?outcomes ;
    	        cspa:restrictions ?restrictions ]] ;
        cspa:hasPackageImplementation [
         	a cspa:ServiceImplementationDescription ;
            cspa:comesFrom [
              a cspa:Provenance ;
              cspa:builderOrganization [
              	cspa:organization ?builderOrg ]]] ;
    	  cspa:label ?label ;
    }
  }
`

/**
 * Builds the query that retrieves the GSBPM subprocess for a given service.
 */
//TODO investigate, we shouldn't need DISTINCT, should we ?
const serviceSubprocesses = service => `
  PREFIX cspa: <${CSPAPrefix}>
  PREFIX skos: <${SKOSPrefix}>

  SELECT DISTINCT ?sub ?label
  WHERE {
      <${service}>  cspa:hasPackageDefinition ?definition .
      ?definition cspa:aimsAt ?function .
      ?function  cspa:gsbpmSubProcess ?sub .
      ?sub       skos:prefLabel ?label
  }
`

/**
 * Builds the query that retrieves the list of all GSBPM subprocesses.
 */
const subprocesses = () => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?sub ?label ?code
  WHERE {
    ?sub a gsbpm:SubProcess ;
         skos:prefLabel ?label ;
         skos:notation ?code
  }
  ORDER BY ?code
`

/**
 * Builds the query that retrieves the list of GSIM inputs of a given CSPA service.
 */
const serviceInputs = service => `
  PREFIX cspa:  <${CSPAPrefix}>
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX rdfs:  <${RDFSPrefix}>

  SELECT DISTINCT ?gsimClass ?label ?definition
  WHERE {
      <${service}> a cspa:package ;
          cspa:label ?servicelabel ;
          cspa:hasPackageDefinition ?pckgDefinition .

      ?pckgDefinition
          cspa:definitionHasInput ?input .
      ?input cspa:gsimInput ?gsimClass .
      ?gsimClass rdfs:label ?label .
      ?gsimClass gsim:classDefinition ?definition
  }
`
/**
 * Builds the query that retrieves the list of GSIM outputs of a given CSPA service.
 */
const serviceOutputs = service => `
  PREFIX cspa:  <${CSPAPrefix}>
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX rdfs:  <${RDFSPrefix}>

  SELECT DISTINCT ?gsimClass ?label ?definition
  WHERE {
      <${service}> a cspa:package ;
          cspa:label ?servicelabel ;
          cspa:hasPackageDefinition ?pckgDefinition .

      ?pckgDefinition
          cspa:definitionHasOutput ?input .
      ?input cspa:gsimOutput ?gsimClass .
      ?gsimClass rdfs:label ?label .
      ?gsimClass gsim:classDefinition ?definition
  }
`

/**
 * Builds the query that retrieves the list of all GSIM groups.
 */
const GSIMGroups = () => `
  PREFIX gsim: <${GSIMPrefix}>
  PREFIX rdfs: <${RDFSPrefix}>

  SELECT ?group ?label WHERE {
  	?group rdfs:subClassOf gsim:GSIMObject .
    ?group rdfs:label ?label
  }
`

/**
 * Builds the query that retrieves the list of all GSIM objects of a given group.
 */
const GSIMClasses = group => `
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?GSIMClass ?label ?definition WHERE {
    ?GSIMClass rdfs:subClassOf <${group}> ;
               gsim:classDefinition ?definition ;
               rdfs:label ?label
  }
`

/**
 * Builds the query that retrieves the list of all GSIM objects.
 */
const GSIMAllClasses = () => `
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?GSIMClass ?label ?definition WHERE {
    ?GSIMClass rdfs:subClassOf ?group ;
               gsim:classDefinition ?definition ;
               rdfs:label ?label .
    ?group rdfs:subClassOf gsim:GSIMObject
  }
`

/**
 * Builds the query that retrieves the list of all CSPA services with a given GSIM input.
 */
const servicesByGSIMInput = GSIMClass => `
  PREFIX cspa:  <${CSPAPrefix}>
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX rdfs:  <${RDFSPrefix}>

  SELECT DISTINCT ?service ?label
  WHERE {
    ?service a cspa:package ;
             cspa:label ?label ;
             cspa:hasPackageDefinition ?pckgDefinition .

    ?pckgDefinition cspa:definitionHasInput ?input .
    ?input cspa:gsimInput <${GSIMClass}>
  }
`

/**
 * Builds the query that retrieves the list of all CSPA services with a given GSIM output.
 */
const servicesByGSIMOutput = GSIMClass => `
  PREFIX cspa:  <${CSPAPrefix}>
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX rdfs:  <${RDFSPrefix}>

  SELECT DISTINCT ?service ?label
  WHERE {
    ?service a cspa:package ;
             cspa:label ?label ;
             cspa:hasPackageDefinition ?pckgDefinition .

    ?pckgDefinition cspa:definitionHasOutput ?input .
    ?input cspa:gsimOutput <${GSIMClass}>
  }
`

/**
 * Builds the query that retrieves the list of all CSPA services in a given GSBPM subprocess.
 */
const servicesByGSBPMSubProcess = (GSBPMSub) => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>
  PREFIX cspa:  <${CSPAPrefix}>

  SELECT ?service ?label WHERE {
    ?function cspa:gsbpmSubProcess <${GSBPMSub}> .
    ?definition cspa:aimsAt ?function .
    ?service cspa:hasPackageDefinition ?definition .
    ?service cspa:label ?label
  }
`

/**
 * Builds the query that retrieves the list of all CSPA services in a given GSBPM phase.
 */
const servicesByGSBPMPhase = (GSBPMPhase) => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>
  PREFIX cspa:  <${CSPAPrefix}>

  SELECT ?service ?label WHERE {
    <${GSBPMPhase}> skos:narrower ?subprocess .
    ?function cspa:gsbpmSubProcess ?subprocess .
    ?definition cspa:aimsAt ?function .
    ?service cspa:hasPackageDefinition ?definition .
    ?service cspa:label ?label
  }
`

/**
 * Builds the query that retrieves the details for a GSIM class
 */
const GSIMClassDetails = GSIMClass => `
  PREFIX gsim: <${GSIMPrefix}>
  PREFIX rdfs:  <${RDFSPrefix}>

  SELECT ?label ?definition ?explanatoryText
  WHERE {
    <${GSIMClass}> rdfs:label ?label ;
                   gsim:classDefinition ?definition ;
                   gsim:classExplanatoryText ?explanatoryText
  }
`

/**
 * Builds the query that retrieves the details for a GSBPM sub process
 */
const GSBPMSubProcessDetails = GSBPMSub => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?label ?code ?definition
  WHERE {
    <${GSBPMSub}> skos:prefLabel ?label ;
                  skos:notation ?code ;
                  skos:definition ?definition
  }
`

/**
 * Builds the query that retrieves the details for a GSBPM sub process
 */
const GSBPMPhaseDetails = GSBPMPhase => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?label ?code ?definition
  WHERE {
    <${GSBPMPhase}> skos:prefLabel ?label ;
                  skos:notation ?code ;
                  skos:definition ?definition
  }
`
/**
 * Builds the query that retrives all the organizations
 */
const organizations = () => `
  PREFIX org: <${ORGPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?org ?label
  WHERE {
    ?org a org:Organization ;
         skos:prefLabel ?label
  }
`
export default {
  NSIList,
  GSBPMDescription,
  services,
  serviceDetails,
  serviceSubprocesses,
  serviceInputs,
  serviceOutputs,
  servicesByGSIMInput,
  servicesByGSIMOutput,
  subprocesses,
  GSIMClasses,
  GSIMAllClasses,
  servicesByGSBPMSubProcess,
  servicesByGSBPMPhase,
  GSIMGroups,
  GSIMClassDetails,
  GSBPMSubProcessDetails,
  GSBPMPhaseDetails,
  organizations
}
<commit_msg>Add order to services to avoid re-ordering when we update a service<commit_after>import {
  SKOSPrefix, ORGPrefix, GSBPMPrefix, GSIMPrefix, RDFSPrefix, CSPAPrefix
} from './prefixes'

// TODO we might need to filter on the language, but for now English seems to be
// the only language available

/**
 * Builds the query that retrieves the list of NSIs.
 */
const NSIList = () => `
  PREFIX org: <${ORGPrefix}>
  PREFIX skos: <${SKOSPrefix}>

  SELECT ?nsi ?label

  WHERE {
    ?nsi a org:Organization ; skos:prefLabel ?label .
  }
  ORDER BY ?nsi
 `

/**
 * Builds the query that retrieves the GSBPM overview.
 */
const GSBPMDescription = () => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>
  SELECT ?phase ?phaseLabel ?subprocess ?subprocessLabel ?phaseCode
         ?subprocessCode ?subprocessDefinition
  WHERE {
   ?phase a gsbpm:Phase ;
          skos:narrower ?subprocess ;
   OPTIONAL {
     ?phase skos:prefLabel ?phaseLabel
   }
   OPTIONAL {
     ?subprocess skos:prefLabel ?subprocessLabel
	 }
   OPTIONAL {
     ?subprocess skos:definition ?subprocessDefinition
   }
   OPTIONAL {
     ?phase skos:notation ?phaseCode
   }
   OPTIONAL {
     ?subprocess skos:notation ?subprocessCode
   }
  }
 `

 /**
  * Builds the query that retrieves the list of CSPA services.
  */
const services = () => `
  PREFIX cspa:  <${CSPAPrefix}>
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT distinct ?service ?label ?description
  WHERE {
    ?service a cspa:package .
    OPTIONAL {?service cspa:label ?label}
	  OPTIONAL {?service cspa:hasPackageDefinition [
    	   a cspa:ServiceDefinition; cspa:aimsAt [cspa:description ?description]]}
  }
  ORDER BY ?label
`

/**
 * Builds the query that retrieves the details of a given CSPA service.
 */
const serviceDetails = service => `
  PREFIX cspa: <${CSPAPrefix}>
  PREFIX skos: <${SKOSPrefix}>

  SELECT
    ?label ?description ?outcomes ?subprocess ?restrictions ?graphName
    ?builderOrg
  WHERE {
    GRAPH ?graphName {
      <${service}>
        cspa:hasPackageDefinition [
    	     a cspa:ServiceDefinition; cspa:aimsAt [
             cspa:description ?description ;
    	        cspa:outcomes ?outcomes ;
    	        cspa:restrictions ?restrictions ]] ;
        cspa:hasPackageImplementation [
         	a cspa:ServiceImplementationDescription ;
            cspa:comesFrom [
              a cspa:Provenance ;
              cspa:builderOrganization [
              	cspa:organization ?builderOrg ]]] ;
    	  cspa:label ?label ;
    }
  }
`

/**
 * Builds the query that retrieves the GSBPM subprocess for a given service.
 */
//TODO investigate, we shouldn't need DISTINCT, should we ?
const serviceSubprocesses = service => `
  PREFIX cspa: <${CSPAPrefix}>
  PREFIX skos: <${SKOSPrefix}>

  SELECT DISTINCT ?sub ?label
  WHERE {
      <${service}>  cspa:hasPackageDefinition ?definition .
      ?definition cspa:aimsAt ?function .
      ?function  cspa:gsbpmSubProcess ?sub .
      ?sub       skos:prefLabel ?label
  }
`

/**
 * Builds the query that retrieves the list of all GSBPM subprocesses.
 */
const subprocesses = () => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?sub ?label ?code
  WHERE {
    ?sub a gsbpm:SubProcess ;
         skos:prefLabel ?label ;
         skos:notation ?code
  }
  ORDER BY ?code
`

/**
 * Builds the query that retrieves the list of GSIM inputs of a given CSPA service.
 */
const serviceInputs = service => `
  PREFIX cspa:  <${CSPAPrefix}>
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX rdfs:  <${RDFSPrefix}>

  SELECT DISTINCT ?gsimClass ?label ?definition
  WHERE {
      <${service}> a cspa:package ;
          cspa:label ?servicelabel ;
          cspa:hasPackageDefinition ?pckgDefinition .

      ?pckgDefinition
          cspa:definitionHasInput ?input .
      ?input cspa:gsimInput ?gsimClass .
      ?gsimClass rdfs:label ?label .
      ?gsimClass gsim:classDefinition ?definition
  }
`
/**
 * Builds the query that retrieves the list of GSIM outputs of a given CSPA service.
 */
const serviceOutputs = service => `
  PREFIX cspa:  <${CSPAPrefix}>
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX rdfs:  <${RDFSPrefix}>

  SELECT DISTINCT ?gsimClass ?label ?definition
  WHERE {
      <${service}> a cspa:package ;
          cspa:label ?servicelabel ;
          cspa:hasPackageDefinition ?pckgDefinition .

      ?pckgDefinition
          cspa:definitionHasOutput ?input .
      ?input cspa:gsimOutput ?gsimClass .
      ?gsimClass rdfs:label ?label .
      ?gsimClass gsim:classDefinition ?definition
  }
`

/**
 * Builds the query that retrieves the list of all GSIM groups.
 */
const GSIMGroups = () => `
  PREFIX gsim: <${GSIMPrefix}>
  PREFIX rdfs: <${RDFSPrefix}>

  SELECT ?group ?label WHERE {
  	?group rdfs:subClassOf gsim:GSIMObject .
    ?group rdfs:label ?label
  }
`

/**
 * Builds the query that retrieves the list of all GSIM objects of a given group.
 */
const GSIMClasses = group => `
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?GSIMClass ?label ?definition WHERE {
    ?GSIMClass rdfs:subClassOf <${group}> ;
               gsim:classDefinition ?definition ;
               rdfs:label ?label
  }
`

/**
 * Builds the query that retrieves the list of all GSIM objects.
 */
const GSIMAllClasses = () => `
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?GSIMClass ?label ?definition WHERE {
    ?GSIMClass rdfs:subClassOf ?group ;
               gsim:classDefinition ?definition ;
               rdfs:label ?label .
    ?group rdfs:subClassOf gsim:GSIMObject
  }
`

/**
 * Builds the query that retrieves the list of all CSPA services with a given GSIM input.
 */
const servicesByGSIMInput = GSIMClass => `
  PREFIX cspa:  <${CSPAPrefix}>
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX rdfs:  <${RDFSPrefix}>

  SELECT DISTINCT ?service ?label
  WHERE {
    ?service a cspa:package ;
             cspa:label ?label ;
             cspa:hasPackageDefinition ?pckgDefinition .

    ?pckgDefinition cspa:definitionHasInput ?input .
    ?input cspa:gsimInput <${GSIMClass}>
  }
`

/**
 * Builds the query that retrieves the list of all CSPA services with a given GSIM output.
 */
const servicesByGSIMOutput = GSIMClass => `
  PREFIX cspa:  <${CSPAPrefix}>
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX gsim:  <${GSIMPrefix}>
  PREFIX rdfs:  <${RDFSPrefix}>

  SELECT DISTINCT ?service ?label
  WHERE {
    ?service a cspa:package ;
             cspa:label ?label ;
             cspa:hasPackageDefinition ?pckgDefinition .

    ?pckgDefinition cspa:definitionHasOutput ?input .
    ?input cspa:gsimOutput <${GSIMClass}>
  }
`

/**
 * Builds the query that retrieves the list of all CSPA services in a given GSBPM subprocess.
 */
const servicesByGSBPMSubProcess = (GSBPMSub) => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>
  PREFIX cspa:  <${CSPAPrefix}>

  SELECT ?service ?label WHERE {
    ?function cspa:gsbpmSubProcess <${GSBPMSub}> .
    ?definition cspa:aimsAt ?function .
    ?service cspa:hasPackageDefinition ?definition .
    ?service cspa:label ?label
  }
`

/**
 * Builds the query that retrieves the list of all CSPA services in a given GSBPM phase.
 */
const servicesByGSBPMPhase = (GSBPMPhase) => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>
  PREFIX cspa:  <${CSPAPrefix}>

  SELECT ?service ?label WHERE {
    <${GSBPMPhase}> skos:narrower ?subprocess .
    ?function cspa:gsbpmSubProcess ?subprocess .
    ?definition cspa:aimsAt ?function .
    ?service cspa:hasPackageDefinition ?definition .
    ?service cspa:label ?label
  }
`

/**
 * Builds the query that retrieves the details for a GSIM class
 */
const GSIMClassDetails = GSIMClass => `
  PREFIX gsim: <${GSIMPrefix}>
  PREFIX rdfs:  <${RDFSPrefix}>

  SELECT ?label ?definition ?explanatoryText
  WHERE {
    <${GSIMClass}> rdfs:label ?label ;
                   gsim:classDefinition ?definition ;
                   gsim:classExplanatoryText ?explanatoryText
  }
`

/**
 * Builds the query that retrieves the details for a GSBPM sub process
 */
const GSBPMSubProcessDetails = GSBPMSub => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?label ?code ?definition
  WHERE {
    <${GSBPMSub}> skos:prefLabel ?label ;
                  skos:notation ?code ;
                  skos:definition ?definition
  }
`

/**
 * Builds the query that retrieves the details for a GSBPM sub process
 */
const GSBPMPhaseDetails = GSBPMPhase => `
  PREFIX gsbpm: <${GSBPMPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?label ?code ?definition
  WHERE {
    <${GSBPMPhase}> skos:prefLabel ?label ;
                  skos:notation ?code ;
                  skos:definition ?definition
  }
`
/**
 * Builds the query that retrives all the organizations
 */
const organizations = () => `
  PREFIX org: <${ORGPrefix}>
  PREFIX skos:  <${SKOSPrefix}>

  SELECT ?org ?label
  WHERE {
    ?org a org:Organization ;
         skos:prefLabel ?label
  }
`
export default {
  NSIList,
  GSBPMDescription,
  services,
  serviceDetails,
  serviceSubprocesses,
  serviceInputs,
  serviceOutputs,
  servicesByGSIMInput,
  servicesByGSIMOutput,
  subprocesses,
  GSIMClasses,
  GSIMAllClasses,
  servicesByGSBPMSubProcess,
  servicesByGSBPMPhase,
  GSIMGroups,
  GSIMClassDetails,
  GSBPMSubProcessDetails,
  GSBPMPhaseDetails,
  organizations
}
<|endoftext|>


<commit_before>var clean = require('./clean');
var lint = require('./lint');
var typescript = require('./typescript');

module.exports = { clean, lint, typescript };
<commit_msg>Forgot to remove typescript.js from the index<commit_after>var clean = require('./clean');
var lint = require('./lint');

module.exports = { clean, lint };
<|endoftext|>


<commit_before>'use strict';
import { characters, generate } from "./generate.js";
// State I want to keep around that doesn't appear in the file system
var bg = {};
var onClipboard = false;
var masterpw = "";
var activetab;
var hpSPG = {};
var bkmkid;
var legacy = false;  // true to emulate HP Antiphishing Toolbar
var lastpersona = "everyone";
var domainname = "";
var protocol = "";
var persona;
var pwcount = 0;
console.log("bg clear masterpw");

console.log("bg starting");

chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
    console.log(Date.now(), "bg got message request, sender", request, sender);
    retrieveMetadata().then(() => {
        chrome.storage.session.get(["ssp"], (ssp) => {
            if (ssp.ssp) {
                persona = ssp.ssp.personaname || "default";
                bg.lastpersona = persona;
                masterpw = ssp.ssp.masterpw || "";
                bg.masterpw = masterpw;
                console.log("bg got ssp", persona || "foo", masterpw || "bar");
            }
            if (request.cmd === "getMetadata") {
                getMetadata(request, sender, sendResponse);
            } else if (request.cmd === "siteData") {
                console.log("bg got site data", request);
                onClipboard = request.onClipboard;
                bg = clone(request.bg);
                bg.lastpersona = request.personaname;
                masterpw = bg.masterpw;
                hpSPG.personas[bg.lastpersona].sitenames[request.sitename] = bg.settings;
                persistMetadata(bkmkid);
            } else if (request.cmd === "getPassword") {
                let domainname = getdomainname(sender.tab.url);
                bg.settings = bgsettings(bg.lastpersona, domainname);
                let pr = generate(bg, hpSPG);
                console.log("bg calculated sitepw", bg, hpSPG, pr, masterpw);
                sendResponse(pr.p);
            } else if (request.clicked) {
                domainname = getdomainname(sender.tab.url);
                bg.domainname = domainname;
                console.log("bg clicked: sending response", bg);
                sendResponse(bg);
                if (persona.clearmasterpw) {
                    masterpw = "";
                    console.log("bg clear masterpw")
                }
            } else if (request.onload) {
                onContentPageload(request, sender, sendResponse);
            }
            console.log(Date.now(), "bg addListener returning: masterpw", masterpw || "masterpw not defined");
        });
    });
    return true;
});
async function getMetadata(request, _sender, sendResponse) {
    bg.lastpersona = request.personaname;
    let sitename = hpSPG.personas[bg.lastpersona].sites[request.domainname]
    if (sitename) {
        bg.settings = hpSPG.personas[bg.lastpersona].sitenames[sitename];
    } else {
        bg.settings = hpSPG.personas[bg.lastpersona].sitenames.default;
    }
    // Domain name comes from popup, which is trusted not to spoof it
    bg.settings.domainname = request.domainname || domainname;
    console.log("bg sending metadata", bg, hpSPG);
    sendResponse({ "masterpw": masterpw || "", "bg": bg, "hpSPG": hpSPG });
}
function onContentPageload(request, sender, sendResponse) {
    activetab = sender.tab;
    bg.pwcount = request.count;
    protocol = request.protocol;
    pwcount = bg.pwcount;
    // Domain name comes from content script, which might have been corrupted to spoof it
    let domainname = getdomainname(sender.tab.url);
    console.log("bg pwcount, domainname, masterpw", bg.pwcount, domainname, masterpw);
    let persona = hpSPG.personas[bg.lastpersona];
    let sitename = persona.sites[domainname];
    if (sitename) {
        bg.settings = persona.sitenames[sitename];
    } else {
        bg.settings = persona.sitenames.default;
    }
    bg.settings.domainname = domainname;
    let readyForClick = false;
    if (masterpw && bg.settings.sitename && bg.settings.username) {
        readyForClick = true;
    }
    let sitepass = "";
    if (bg.pwcount === 0 && bg.settings.username) {
        let pr = generate(bg, hpSPG);
        sitepass = pr.p;
    }
    console.log(Date.now(), "bg send response", { cmd: "fillfields", "u": bg.settings.username || "", "p": sitepass, "readyForClick": readyForClick });
    sendResponse({ cmd: "fillfields", "u": bg.settings.username || "", "p": sitepass, "readyForClick": readyForClick });
}
function gotMetadata(hpSPGlocal) {
    if (!hpSPGlocal) {
        hpSPGlocal = {
            digits: "0123456789",
            lower: "abcdefghijklmnopqrstuvwxyz",
            upper: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
            specials: "/!=@?._-",
            miniter: 10,
            maxiter: 1000,
            personas: {
                default: {
                    personaname: "default",
                    clearmasterpw: false,
                    sites: {},
                    sitenames: {
                        default: {
                            sitename: "",
                            username: "",
                            length: 12,
                            domainname: "",
                            startwithletter: true,
                            allowlower: true,
                            allowupper: true,
                            allownumber: true,
                            allowspecial: false,
                            minlower: 1,
                            minupper: 1,
                            minnumber: 1,
                            minspecial: 0,
                            specials: "",
                            characters: ""
                        }
                    }
                }
            }
        }
        hpSPG = hpSPGlocal;
        hpSPGlocal.personas.default.sitenames.default.specials = hpSPGlocal.specials;
        let defaultsettings = hpSPGlocal.personas.default.sitenames.default;
        bg.settings = defaultsettings;
        defaultsettings.characters = characters(defaultsettings, hpSPG);
        hpSPGlocal.personas.everyone = clone(hpSPGlocal.personas.default);
        persona = hpSPGlocal.personas.everyone;
        persona.personaname = "Everyone";
        hpSPG = hpSPGlocal;
        persistMetadata(bkmkid);
    }
    hpSPG = hpSPGlocal;
}
async function persistMetadata(bkmkid) {
    // localStorage[name] = JSON.stringify(value);
    console.log("bg persistMetadata", bg, hpSPG);
    persona = hpSPG.personas[bg.lastpersona];
    if (bg.settings.sitename) {
        persona.sites[bg.settings.domainname] = bg.settings.sitename;
        persona.sitenames[bg.settings.sitename] = bg.settings;
    }
    let update = "ssp://" + JSON.stringify(hpSPG);
    if (hpSPG.personas[bg.lastpersona].sites[""]) {
        alert("bg bad sitename", hpSPG);
    }
    chrome.bookmarks.update(bkmkid, { "url": update });
    chrome.storage.session.set({ "ssp": { "masterpw": masterpw, "personaname": bg.lastpersona } });
}
async function retrieveMetadata() {
    // return JSON.parse(localStorage[name]);
    console.log("Retrieving metadata");
    let bkmkstr = await chrome.storage.local.get(["bkmkstr"]);
    try {
        let bkmk = JSON.parse(bkmkstr.bkmkstr);
        console.log("bg got bookmark", bkmk);
        if (bkmk) bkmkid = bkmk.bkmkid;
        console.log("Got SSP bookmark ID " + bkmkid);
        bkmk = await chrome.bookmarks.get(bkmkid);
        console.log("Got bookmark: ", bkmk);
        hpSPG = parseBkmk(bkmk[0]);
    } catch (e) {
        // Find ssp bookmark
        let tree = await chrome.bookmarks.getTree();
        console.log("Find SSP bookmark");
        let found = false;
        tree[0].children[0].children.forEach((bkmk, _index) => {
            if (!found && bkmk.url.substring(0, 6) == "ssp://") {
                found = true;
                console.log("Found bookmark: ", bkmk);
                bkmkid = bkmk.id;
                let value = { "bkmkid": bkmkid };
                chrome.storage.local.set({ "bkmk": JSON.stringify(value) });
                hpSPG = parseBkmk(bkmk);
            }
        });
        if (!found) {
            let bkmk = await chrome.bookmarks.create({ "parentId": "1", "title": "SitePasswordData", "url": "ssp://" });
            console.log("Creating SSP bookmark");
            bkmkid = bkmk.id;
            let value = { "bkmkid": bkmkid };
            chrome.storage.local.set({ "bkmkstr": JSON.stringify(value) });
            console.log("Bookmark id: " + bkmkid);
            hpSPG = undefined;
        }
    }
    gotMetadata(hpSPG);
    // Doing it this way because bg.js used to be a background page,
    // and I don't want to change a lot of code after I moved it to
    // the popup.
    let persona = hpSPG.personas[lastpersona];
    let sitename = persona.sites[domainname];
    let settings;
    if (sitename) {
        settings = persona.sitenames[sitename];
    } else {
        settings = persona.sitenames.default;
    }
    settings.legacy = legacy;
    bg = {
        "activetab": activetab,
        "lastpersona": lastpersona,
        "masterpw": masterpw,
        "protocol": protocol,
        "pwcount": pwcount,
        "settings": settings,
    };
    console.log(Date.now(), "bg leaving retrieiveMetadata", bg, hpSPG);
}
function parseBkmk(bkmk) {
    console.log("Parsing bookmark");
    try {
        // JSON.stringify turns some of my " into %22
        hpSPG = JSON.parse(bkmk.url.substr(6).replace(/%22/g, "\""));
    } catch (e) {
        console.error("Error parsing metadata " + e);
        hpSPG = undefined;
    }
    return hpSPG;
}
function bgsettings(personaname, domainname) {
    let persona = hpSPG.personas[personaname];
    if (!persona) {
        hpSPG.personas[personaname] = clone(hpSPG.personas.default);
        persona = hpSPG.personas[personaname];
        bg.settings = clone(persona.sitenames.default);
        persona.personaname = personaname;
        bg.settings.domainname = domainname;
        bg.settings.characters = characters(bg.settings, hpSPG);
    }
    if (persona.sites[domainname]) {
        bg.settings = persona.sitenames[persona.sites[domainname]];
    } else {
        bg.settings = persona.sitenames.default;
        bg.settings.domainname = domainname;
    }
    return bg.settings;
}
function clone(object) {
    return JSON.parse(JSON.stringify(object))
}
function getdomainname(url) {
    return url.split("/")[2];
}
function getprotocol(url) {
    return url.split(":")[0];
}
/*
Copyright 2011 Hewlett-Packard Company. This library is free software;
you can redistribute it and/or modify it under the terms of the GNU
Lesser General Public License (LGPL) as published by the Free Software
Foundation; either version 2.1 of the License, or (at your option) any
later version. This library 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
Lesser General Public License for more details. You should have
received a copy of the GNU Lesser General Public License (LGPL) along
with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Please contact the Hewlett-Packard Company <www.hp.com> for

information regarding how to obtain the source code for this library.
*/
<commit_msg>Fixed URL to use for domainname<commit_after>'use strict';
import { characters, generate } from "./generate.js";
// State I want to keep around that doesn't appear in the file system
var bg = {};
var onClipboard = false;
var masterpw = "";
var activetab;
var hpSPG = {};
var bkmkid;
var legacy = false;  // true to emulate HP Antiphishing Toolbar
var lastpersona = "everyone";
var domainname = "";
var protocol = "";
var persona;
var pwcount = 0;
console.log("bg clear masterpw");

console.log("bg starting");

chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
    console.log(Date.now(), "bg got message request, sender", request, sender);
    retrieveMetadata().then(() => {
        chrome.storage.session.get(["ssp"], (ssp) => {
            if (ssp.ssp) {
                persona = ssp.ssp.personaname || "default";
                bg.lastpersona = persona;
                masterpw = ssp.ssp.masterpw || "";
                bg.masterpw = masterpw;
                console.log("bg got ssp", persona || "foo", masterpw || "bar");
            }
            if (request.cmd === "getMetadata") {
                getMetadata(request, sender, sendResponse);
            } else if (request.cmd === "siteData") {
                console.log("bg got site data", request);
                onClipboard = request.onClipboard;
                bg = clone(request.bg);
                bg.lastpersona = request.personaname;
                masterpw = bg.masterpw;
                hpSPG.personas[bg.lastpersona].sitenames[request.sitename] = bg.settings;
                persistMetadata(bkmkid);
            } else if (request.cmd === "getPassword") {
                let domainname = getdomainname(sender.origin);
                bg.settings = bgsettings(bg.lastpersona, domainname);
                let pr = generate(bg, hpSPG);
                console.log("bg calculated sitepw", bg, hpSPG, pr, masterpw);
                sendResponse(pr.p);
            } else if (request.clicked) {
                domainname = getdomainname(sender.origin);
                bg.domainname = domainname;
                console.log("bg clicked: sending response", bg);
                sendResponse(bg);
                if (persona.clearmasterpw) {
                    masterpw = "";
                    console.log("bg clear masterpw")
                }
            } else if (request.onload) {
                onContentPageload(request, sender, sendResponse);
            }
            console.log(Date.now(), "bg addListener returning: masterpw", masterpw || "masterpw not defined");
        });
    });
    return true;
});
async function getMetadata(request, _sender, sendResponse) {
    bg.lastpersona = request.personaname;
    let sitename = hpSPG.personas[bg.lastpersona].sites[request.domainname]
    if (sitename) {
        bg.settings = hpSPG.personas[bg.lastpersona].sitenames[sitename];
    } else {
        bg.settings = hpSPG.personas[bg.lastpersona].sitenames.default;
    }
    // Domain name comes from popup, which is trusted not to spoof it
    bg.settings.domainname = request.domainname || domainname;
    console.log("bg sending metadata", bg, hpSPG);
    sendResponse({ "masterpw": masterpw || "", "bg": bg, "hpSPG": hpSPG });
}
function onContentPageload(request, sender, sendResponse) {
    activetab = sender.tab;
    bg.pwcount = request.count;
    protocol = request.protocol;
    pwcount = bg.pwcount;
    // Domain name comes from content script, which might have been corrupted to spoof it
    let domainname = getdomainname(sender.origin);
    console.log("bg pwcount, domainname, masterpw", bg.pwcount, domainname, masterpw);
    let persona = hpSPG.personas[bg.lastpersona];
    let sitename = persona.sites[domainname];
    if (sitename) {
        bg.settings = persona.sitenames[sitename];
    } else {
        bg.settings = persona.sitenames.default;
    }
    bg.settings.domainname = domainname;
    let readyForClick = false;
    if (masterpw && bg.settings.sitename && bg.settings.username) {
        readyForClick = true;
    }
    let sitepass = "";
    if (bg.pwcount === 0 && bg.settings.username) {
        let pr = generate(bg, hpSPG);
        sitepass = pr.p;
    }
    console.log(Date.now(), "bg send response", { cmd: "fillfields", "u": bg.settings.username || "", "p": sitepass, "readyForClick": readyForClick });
    sendResponse({ cmd: "fillfields", "u": bg.settings.username || "", "p": sitepass, "readyForClick": readyForClick });
}
function gotMetadata(hpSPGlocal) {
    if (!hpSPGlocal) {
        hpSPGlocal = {
            digits: "0123456789",
            lower: "abcdefghijklmnopqrstuvwxyz",
            upper: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
            specials: "/!=@?._-",
            miniter: 10,
            maxiter: 1000,
            personas: {
                default: {
                    personaname: "default",
                    clearmasterpw: false,
                    sites: {},
                    sitenames: {
                        default: {
                            sitename: "",
                            username: "",
                            length: 12,
                            domainname: "",
                            startwithletter: true,
                            allowlower: true,
                            allowupper: true,
                            allownumber: true,
                            allowspecial: false,
                            minlower: 1,
                            minupper: 1,
                            minnumber: 1,
                            minspecial: 0,
                            specials: "",
                            characters: ""
                        }
                    }
                }
            }
        }
        hpSPG = hpSPGlocal;
        hpSPGlocal.personas.default.sitenames.default.specials = hpSPGlocal.specials;
        let defaultsettings = hpSPGlocal.personas.default.sitenames.default;
        bg.settings = defaultsettings;
        defaultsettings.characters = characters(defaultsettings, hpSPG);
        hpSPGlocal.personas.everyone = clone(hpSPGlocal.personas.default);
        persona = hpSPGlocal.personas.everyone;
        persona.personaname = "Everyone";
        hpSPG = hpSPGlocal;
        persistMetadata(bkmkid);
    }
    hpSPG = hpSPGlocal;
}
async function persistMetadata(bkmkid) {
    // localStorage[name] = JSON.stringify(value);
    console.log("bg persistMetadata", bg, hpSPG);
    persona = hpSPG.personas[bg.lastpersona];
    if (bg.settings.sitename) {
        persona.sites[bg.settings.domainname] = bg.settings.sitename;
        persona.sitenames[bg.settings.sitename] = bg.settings;
    }
    let update = "ssp://" + JSON.stringify(hpSPG);
    if (hpSPG.personas[bg.lastpersona].sites[""]) {
        alert("bg bad sitename", hpSPG);
    }
    chrome.bookmarks.update(bkmkid, { "url": update });
    chrome.storage.session.set({ "ssp": { "masterpw": masterpw, "personaname": bg.lastpersona } });
}
async function retrieveMetadata() {
    // return JSON.parse(localStorage[name]);
    console.log("Retrieving metadata");
    let bkmkstr = await chrome.storage.local.get(["bkmkstr"]);
    try {
        let bkmk = JSON.parse(bkmkstr.bkmkstr);
        console.log("bg got bookmark", bkmk);
        if (bkmk) bkmkid = bkmk.bkmkid;
        console.log("Got SSP bookmark ID " + bkmkid);
        bkmk = await chrome.bookmarks.get(bkmkid);
        console.log("Got bookmark: ", bkmk);
        hpSPG = parseBkmk(bkmk[0]);
    } catch (e) {
        // Find ssp bookmark
        let tree = await chrome.bookmarks.getTree();
        console.log("Find SSP bookmark");
        let found = false;
        tree[0].children[0].children.forEach((bkmk, _index) => {
            if (!found && bkmk.url.substring(0, 6) == "ssp://") {
                found = true;
                console.log("Found bookmark: ", bkmk);
                bkmkid = bkmk.id;
                let value = { "bkmkid": bkmkid };
                chrome.storage.local.set({ "bkmk": JSON.stringify(value) });
                hpSPG = parseBkmk(bkmk);
            }
        });
        if (!found) {
            let bkmk = await chrome.bookmarks.create({ "parentId": "1", "title": "SitePasswordData", "url": "ssp://" });
            console.log("Creating SSP bookmark");
            bkmkid = bkmk.id;
            let value = { "bkmkid": bkmkid };
            chrome.storage.local.set({ "bkmkstr": JSON.stringify(value) });
            console.log("Bookmark id: " + bkmkid);
            hpSPG = undefined;
        }
    }
    gotMetadata(hpSPG);
    // Doing it this way because bg.js used to be a background page,
    // and I don't want to change a lot of code after I moved it to
    // the popup.
    let persona = hpSPG.personas[lastpersona];
    let sitename = persona.sites[domainname];
    let settings;
    if (sitename) {
        settings = persona.sitenames[sitename];
    } else {
        settings = persona.sitenames.default;
    }
    settings.legacy = legacy;
    bg = {
        "activetab": activetab,
        "lastpersona": lastpersona,
        "masterpw": masterpw,
        "protocol": protocol,
        "pwcount": pwcount,
        "settings": settings,
    };
    console.log(Date.now(), "bg leaving retrieiveMetadata", bg, hpSPG);
}
function parseBkmk(bkmk) {
    console.log("Parsing bookmark");
    try {
        // JSON.stringify turns some of my " into %22
        hpSPG = JSON.parse(bkmk.url.substr(6).replace(/%22/g, "\""));
    } catch (e) {
        console.error("Error parsing metadata " + e);
        hpSPG = undefined;
    }
    return hpSPG;
}
function bgsettings(personaname, domainname) {
    let persona = hpSPG.personas[personaname];
    if (!persona) {
        hpSPG.personas[personaname] = clone(hpSPG.personas.default);
        persona = hpSPG.personas[personaname];
        bg.settings = clone(persona.sitenames.default);
        persona.personaname = personaname;
        bg.settings.domainname = domainname;
        bg.settings.characters = characters(bg.settings, hpSPG);
    }
    if (persona.sites[domainname]) {
        bg.settings = persona.sitenames[persona.sites[domainname]];
    } else {
        bg.settings = persona.sitenames.default;
        bg.settings.domainname = domainname;
    }
    return bg.settings;
}
function clone(object) {
    return JSON.parse(JSON.stringify(object))
}
function getdomainname(url) {
    return url.split("/")[2];
}
function getprotocol(url) {
    return url.split(":")[0];
}
/*
Copyright 2011 Hewlett-Packard Company. This library is free software;
you can redistribute it and/or modify it under the terms of the GNU
Lesser General Public License (LGPL) as published by the Free Software
Foundation; either version 2.1 of the License, or (at your option) any
later version. This library 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
Lesser General Public License for more details. You should have
received a copy of the GNU Lesser General Public License (LGPL) along
with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Please contact the Hewlett-Packard Company <www.hp.com> for

information regarding how to obtain the source code for this library.
*/
<|endoftext|>