text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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.
package com.cloud.bridge.io;

import org.apache.log4j.Logger;

import java.io.InputStream;
import java.io.IOException;

/**
 * A DIME stream is actually composed of multiple encoded streams.
 * This class is a wrapper around the DimeDelimitedInputStream inorder
 * to provide a simple iterator like interface for all the streams in a
 * DIME encoded message.
 */
public class MultiPartDimeInputStream
{
    protected final static Logger logger = Logger.getLogger(MultiPartDimeInputStream.class);

    protected InputStream is = null;
    protected DimeDelimitedInputStream currentStream = null;

    protected int     count      = 0;
    protected boolean eos        = false;
    protected String  contentId  = null;
    protected String  type       = null;
    protected String  typeFormat = null;

    /**
     * The SOAP stream must be first, call nextInputStream to get
     * access to the first stream and all streams after that.
     *
     * @param is the true input stream holding the incoming request.
     */
    public MultiPartDimeInputStream( InputStream is ) throws IOException
    {
        this.is = is;
    }

    /**
     * These three methods are DIME specific but provide potentially
     * useful information about the current stream's data.
     *
     * @return URL or MIME type
     */
    public String getStreamType()
    {
        return type;
    }

    public String getStreamTypeFormat()
    {
    	// Is the type a URI or MIME type or just unknown?
        return typeFormat;
    }

    public String getStreamId()
    {
    	// The soap body might have string identifiers to point to other streams in the message
        return contentId;
    }

    public InputStream getInputStream()
    {
    	return currentStream;
    }

    public int available() throws IOException
    {
    	if (eos) return -1;

        if (null == currentStream)
        {
            throw new IOException( "streamClosed -- call nextInputStream()" );
        }
        return currentStream.available();
    }

    /**
     * Move on to the next stream encoded in the DIME stream.
     * If the current stream has not been all read, then we skip the remaining bytes of
     * that stream.
     *
     * @return false if no next input stream, true if next input stream ready
     * @throws IOException
     */
    public boolean nextInputStream() throws IOException
    {
    	if ( null == currentStream )
    	{
    		 // on the first call to this function get the first stream
    		 if (0 == count) currentStream = new DimeDelimitedInputStream( is );
    	}
    	else
    	{    // make sure the bytes of the previous stream are all skipped before we start the next
    		 currentStream.close();
    	     contentId     = null;
    	     type          = null;
    	     typeFormat    = null;
    	     currentStream = currentStream.getNextStream();
    	}

    	if ( null != currentStream )
    	{
             contentId  = currentStream.getContentId();
             type       = currentStream.getType();
             typeFormat = currentStream.getDimeTypeNameFormat();
             eos        = false;
             count++;
             return true;
    	}
    	else return false;
    }

    public long skip( long n ) throws IOException
    {
        if (eos || null == currentStream)
        {
            throw new IOException( "streamClosed -- call nextInputStream()" );
        }
        return currentStream.skip( n );
    }

    public int read( byte[] b, int off, int len ) throws IOException
    {
        if (eos || null == currentStream) return -1;

        int read = currentStream.read( b, off, len );

        if (read < 0) eos = true;

        return read;
    }

    public int read( byte[] b ) throws IOException
    {
        return read( b, 0, b.length );
    }

    public int read() throws IOException
    {
        if (eos || null == currentStream) return -1;

        int ret = currentStream.read();

        if (ret < 0) eos = true;

        return ret;
    }
}


text:
'use strict';

const apiUtils = require('../../lib/utils/api_utils');

describe('apiUtils', () => {
    it('should be able make a prometheus text format', () => {
        const stats = {
            controllers: {
                processed: 1000,
                failed: 10,
                queued: 5,
                job_duration: 10,
                workers_joined: 20,
                workers_disconnected: 30,
                workers_reconnected: 40
            }
        };
        const r = `# TYPE teraslice_slices_processed counter
teraslice_slices_processed ${stats.controllers.processed}
# TYPE teraslice_slices_failed counter
teraslice_slices_failed ${stats.controllers.failed}
# TYPE teraslice_slices_queued counter
teraslice_slices_queued ${stats.controllers.queued}
# TYPE teraslice_workers_joined counter
teraslice_workers_joined ${stats.controllers.workers_joined}
# TYPE teraslice_workers_disconnected counter
teraslice_workers_disconnected ${stats.controllers.workers_disconnected}
# TYPE teraslice_workers_reconnected counter
teraslice_workers_reconnected ${stats.controllers.workers_reconnected}
`;
        expect(apiUtils.makePrometheus(stats)).toEqual(r);
    });

    it('should be able make a prometheus text format with labels', () => {
        const stats = {
            controllers: {
                processed: 1000,
                failed: 10,
                queued: 5,
                job_duration: 10,
                workers_joined: 20,
                workers_disconnected: 30,
                workers_reconnected: 40
            }
        };
        const r = `# TYPE teraslice_slices_processed counter
teraslice_slices_processed{foo="bar"} ${stats.controllers.processed}
# TYPE teraslice_slices_failed counter
teraslice_slices_failed{foo="bar"} ${stats.controllers.failed}
# TYPE teraslice_slices_queued counter
teraslice_slices_queued{foo="bar"} ${stats.controllers.queued}
# TYPE teraslice_workers_joined counter
teraslice_workers_joined{foo="bar"} ${stats.controllers.workers_joined}
# TYPE teraslice_workers_disconnected counter
teraslice_workers_disconnected{foo="bar"} ${stats.controllers.workers_disconnected}
# TYPE teraslice_workers_reconnected counter
teraslice_workers_reconnected{foo="bar"} ${stats.controllers.workers_reconnected}
`;
        expect(apiUtils.makePrometheus(stats, { foo: 'bar' })).toEqual(r);
    });

    it('should be able to detect if a request is prometheus', () => {
        expect(apiUtils.isPrometheusRequest({
            headers: {
                accept: 'blah application/openmetrics-text; blah blah'
            }
        })).toBeTrue();
    });
});

redpajama_set_name: RedPajamaGithub


text:
package chapter.fourteen

object ExerciseSix {

  sealed abstract class BinaryTree
  case class Leaf(value: Int) extends BinaryTree
  case class Node(left: BinaryTree, right: BinaryTree) extends BinaryTree

  def leafSum(tree: BinaryTree): Int = {
    tree match {
      case Node(left, right) => leafSum(left) + leafSum(right)
      case Leaf(value) => value
      case _ => 0
    }
  }

}


text:
package com.p1.mobile.p1android.filter.impl;

import jp.co.cyberagent.android.gpuimage.GPUImageFilter;
import android.content.Context;

import com.p1.mobile.p1android.R;
import com.p1.mobile.p1android.filter.AbstractFilter;
import com.p1.mobile.p1android.filter.FilterBuilder;
import com.p1.mobile.p1android.filter.FilterType;

public class ClairityFilter extends AbstractFilter {

    public ClairityFilter(Context context) {
        setName(context.getResources().getString(R.string.filter_clairity));
    }

    @Override
    protected GPUImageFilter initFilter(Context context) {
        return new FilterBuilder.Builder().sharpen(0.3f).vignette(0.45f, 1.0f)
                .lookup(context, R.drawable.lookup_clarity).build();
    }

    @Override
    public FilterType getFilterType() {

        return FilterType.CLAIRITY;
    }

}


text:
namespace CIK.News.Web.App_Start
{
    using Microsoft.Web.WebPages.OAuth;

    public static class AuthConfig
    {
        public static void RegisterAuth()
        {
            //OAuthWebSecurity.RegisterMicrosoftClient(
            //    clientId: "",
            //    clientSecret: "");

            OAuthWebSecurity.RegisterTwitterClient(
                consumerKey: "daX1XtCiUTPh5ie4xuY22A",
                consumerSecret: "RjXEDwwsifrcO3EweTcAJvuNxZSiqgUUnNwdnjTqPo");

            //OAuthWebSecurity.RegisterFacebookClient(
            //    appId: "",
            //    appSecret: "");

            //OAuthWebSecurity.RegisterGoogleClient();
        }
    }
}


text:
package ua.com.fielden.platform.entity.query.generation.elements;

import ua.com.fielden.platform.entity.query.fluent.enums.LogicalOperator;

public class CompoundCondition {
    private final LogicalOperator logicalOperator;
    private final ICondition condition;

    public CompoundCondition(final LogicalOperator logicalOperator, final ICondition condition) {
        this.logicalOperator = logicalOperator;
        this.condition = condition;
    }

    public LogicalOperator getLogicalOperator() {
        return logicalOperator;
    }

    public ICondition getCondition() {
        return condition;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((condition == null) ? 0 : condition.hashCode());
        result = prime * result + ((logicalOperator == null) ? 0 : logicalOperator.hashCode());
        return result;
    }

    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof CompoundCondition)) {
            return false;
        }
        final CompoundCondition other = (CompoundCondition) obj;
        if (condition == null) {
            if (other.condition != null) {
                return false;
            }
        } else if (!condition.equals(other.condition)) {
            return false;
        }
        if (logicalOperator != other.logicalOperator) {
            return false;
        }
        return true;
    }
}


text:
package com.mooveit.moonitor.principal.actors

import akka.actor.{ActorLogging, Actor}
import com.mooveit.moonitor.domain.metrics.{MetricId, MetricResult}
import com.mooveit.moonitor.principal.actors.MetricsStore.Save

import scalaj.http.Http

class MetricsStore extends Actor with ActorLogging {

  val config = context.system.settings.config

  def sanitize(measurement: MetricId) =
    """(\.|=|,)""".r.replaceAllIn(measurement.toString, """\\$1""")

  override def receive = {
    case Save(host, metricId, MetricResult(timestamp, value)) =>
      val r =
        Http(config.getString("influxdb.write_url")).
          params(("db", s"metrics-$host"), ("precision", "ms")).
          postData(s"${sanitize(metricId)} value=$value $timestamp").
          asString

      log.debug(s"Response: ${r.code}. ${r.headers} || ${r.body}")
  }
}

object MetricsStore {

  case class Save(host: String, metricId: MetricId, metricResult: MetricResult)
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: NicolasUffer
 * Date: 21.10.16
 * Time: 13:44
 */

namespace AppBundle\Voters;

use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use AppBundle\Entity\User;

class CategorieVoter extends BaseVoter{

    protected function getSupportedClass()
    {
        return 'AppBundle\Entity\Categorie';
    }

    /**
     * {@inheritdoc}
     */
    protected function canView($subject, User $user, TokenInterface $token)
    {
        return true;
    }

    /**
     * {@inheritdoc}
     */
    protected function canEdit($subject, User $user, TokenInterface $token)
    {
        return $this->hasRole('ROLE_CATEGORIE_EDIT',$token);
    }

    /**
     * {@inheritdoc}
     */
    protected function canRemove($subject, User $user, TokenInterface $token)
    {
        return $this->hasRole('ROLE_CATEGORIE_REMOVE',$token);
    }

    /**
     * {@inheritdoc}
     */
    protected function canCreate($subject, User $user, TokenInterface $token)
    {
        return $this->hasRole('ROLE_CATEGORIE_CREATE',$token);
    }

}


text:
<?php

namespace lahaut\BaloonWatcherBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use lahaut\BaloonWatcherBundle\Entity\GPSRecord;
use Doctrine\Common\Collections\ArrayCollection;
use lahaut\BaloonWatcherBundle\Entity\ScenarioRepository;

/**
 * Scenario
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="ScenarioRepository")
 */
class Scenario
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var integer
     *
     * @ORM\Column(name="number", type="integer")
     */
    private $number;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="creationDate", type="datetime")
     */
    private $creationDate;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="modificationDate", type="datetime")
     */
    private $modificationDate;

    /**
     * @ORM\OneToMany(targetEntity="\lahaut\BaloonWatcherBundle\Entity\GPSRecord", mappedBy="scenario")
     */
    private $gpsRecordList;

    public function __construct()
    {
        $this->gpsRecordList = new ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set number
     *
     * @param integer $number
     * @return Scenario
     */
    public function setNumber($number)
    {
        $this->number = $number;

        return $this;
    }

    /**
     * Get number
     *
     * @return integer
     */
    public function getNumber()
    {
        return $this->number;
    }

    /**
     * Add gpsRecordList
     *
     * @param GpsRecord $gpsRecordList
     * @return Scenario
     */
    public function addGpsRecordList(GPSRecord $gpsRecordList)
    {
        $this->gpsRecordList[] = $gpsRecordList;

        return $this;
    }

    /**
     * Remove gpsRecordList
     *
     * @param GpsRecord $gpsRecordList
     */
    public function removeGpsRecordList(GPSRecord $gpsRecordList)
    {
        $this->gpsRecordList->removeElement($gpsRecordList);
    }

    /**
     * Get gpsRecordList
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getGpsRecordList()
    {
        return $this->gpsRecordList;
    }

    /**
     * Set creationDate
     *
     * @param \DateTime $creationDate
     * @return Scenario
     */
    public function setCreationDate($creationDate)
    {
        $this->creationDate = $creationDate;

        return $this;
    }

    /**
     * Get creationDate
     *
     * @return \DateTime
     */
    public function getCreationDate()
    {
        return $this->creationDate;
    }

    /**
     * Set modificationDate
     *
     * @param \DateTime $modificationDate
     * @return Scenario
     */
    public function setModificationDate($modificationDate)
    {
        $this->modificationDate = $modificationDate;

        return $this;
    }

    /**
     * Get modificationDate
     *
     * @return \DateTime
     */
    public function getModificationDate()
    {
        return $this->modificationDate;
    }
}


text:
var expect = require('chai').expect
  , fs = require('fs')
  , path = require('path')
  , Decoder = require('../../..').Decoder;

describe('jsr-resp (decoder):', function() {

  it('should decode simple string value', function(done) {
    var dec = new Decoder()
    dec.on('reply', function(err, reply) {
      expect(err).to.eql(null);
      expect(reply).to.eql('OK');
      done();
    })
    var input = path.join(
      __dirname, '..', '..', 'fixtures', 'simple-string.resp');
    var stream = fs.createReadStream(input);
    stream.pipe(dec);
  });

});


text:
<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

//Route::get('/', 'HomeController@login')->name('welcome');
Route::get('/', 'HomeController@index')->name('welcome');

Route::get('/joblist', 'UserController@joblist');

Route::get('/post-details', 'UserController@jobDetails');

Route::get('/cv-list', 'CvListController@cvList');

Route::get('/create-post', function () {
    return view('users.create-post');
});

Route::get('/linkedin', 'UserController@linkedIn');


text:
package nl.wur.ssb.RDF2Graph;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;

import nl.wur.ssb.RDF2Graph.simplify.UniqueTypeLink;
import nl.wur.ssb.RDF2Graph.simplify.Tree;
import nl.wur.ssb.RDF2Graph.simplify.TreeNode;
import nl.wur.ssb.RDFSimpleCon.RDFSimpleCon;
import nl.wur.ssb.RDFSimpleCon.ResultLine;
import nl.wur.ssb.RDFSimpleCon.concurrent.ResultHandler;
import nl.wur.ssb.RDFSimpleCon.concurrent.TaskExecuter;

import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.apache.jena.riot.web.HttpOp;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryFactory;

/*
 * Please see doc manual.pdf for full description of the process
 */

public class Main
{
	private HashSet<String> excludeProps = new HashSet<String>();
	private StatusSystem status;
  private	RDFSimpleCon remoteGraph1;
  private	RDFSimpleCon remoteGraph2;
	private RDFSimpleCon localStore;
	private String project;
	private TaskExecuter executer;
	private boolean collectPredicateStatistics = false;
	private boolean collectClassStatistics = false;
	private boolean collectShapePropertyStatistics = false;
	private boolean checkPredicateSourceClass = false;
	private boolean collectForwardMultiplicity = false;
	private boolean collectReverseMultiplicity = false;
	private boolean executeSimplify = false;
	private boolean treatSubClassOfAsIntanceOf = false;
	private boolean removeOWLClasses = false;
	private boolean eachThreadOnePort = false;
	private boolean useClassPropertyRecoveryPerClass = false;
	private int numberOfThreads = 1;
	private HashMap<String,LinkedList<String>> keepUniq = new HashMap<String,LinkedList<String>>();

	public static void main(String args[]) throws Exception
	{
		BasicConfigurator.configure();
		Logger.getRootLogger().setLevel(Level.WARN);
		Main main = new Main();

		boolean ok = true;

		int rest = 2;
		if(args.length >= 2)
		{
			main.project = args[0];
			main.remoteGraph1 = main.remoteGraph2 = new RDFSimpleCon(args[1]);
			if(args.length >= 3 && args[2].equals("+"))
			{
				main.remoteGraph2 = new RDFSimpleCon(args[3]);
				rest = 4;
			}
		}
		else
		{
			ok = false;
		}
    for(int i = rest;i < args.length;i++)
    {
    	if(args[i].startsWith("--"))
    	{
    	  String enProp = args[i].substring(2);
    	  if(enProp.equals("all"))
    	  {
    	  	main.collectPredicateStatistics = true;
    	  	main.collectClassStatistics = true;
    	  	main.checkPredicateSourceClass = true;
    	  	main.collectShapePropertyStatistics = true;
    	  	main.collectForwardMultiplicity = true;
    	  	main.collectReverseMultiplicity = true;
    	  }
    	  else if(enProp.equals("collectPredicateStatistics"))
      		main.collectPredicateStatistics = true;
      	else if(enProp.equals("collectClassStatistics"))
      		main.collectClassStatistics = true;
      	else if(enProp.equals("collectShapePropertyStatistics"))//TODO Rename
      		main.collectShapePropertyStatistics = true;
      	else if(enProp.equals("checkPredicateSourceClass"))
      		main.checkPredicateSourceClass = true;
      	else if(enProp.equals("collectForwardMultiplicity"))
      		main.collectForwardMultiplicity = true;
      	else if(enProp.equals("collectReverseMultiplicity"))
      		main.collectReverseMultiplicity = true;
      	else if(enProp.equals("executeSimplify"))
      		main.executeSimplify = true;
      	else if(enProp.equals("treatSubClassOfAsIntanceOf"))
      		main.treatSubClassOfAsIntanceOf = true;
      	else if(enProp.equals("removeOWLClasses"))
      		main.removeOWLClasses = true;
      	else if(enProp.equals("eachThreadOnePort"))
      		main.eachThreadOnePort = true;
      	else if(enProp.equals("useClassPropertyRecoveryPerClass"))
      		main.useClassPropertyRecoveryPerClass = true;
      	else if(enProp.equals("multiThread"))
      	{
      		try
      		{
      	  	main.numberOfThreads = Integer.parseInt(args[++i]);
      		}
      		catch(Throwable th)
      		{
      			ok = false;
      		}
      	}
      	else
      	{
      		System.out.println("unknown option: --" + enProp);
      		ok = false;
      		break;
      	}
    	}
    	else
    	{
    		ok = false;
    		break;
    	}
    }
		if(ok)
		{
			if(main.eachThreadOnePort)
			{
				main.remoteGraph1.enableEachThreadSeperatePort(main.numberOfThreads);
			}
	  	main.run();
		}
	  else
	  {
	  	System.out.println("usage: java -jar RDF2Graph.jar <output directory> (<user>:<pass>@)?<uri of sparql endpoint>([<uri of graph>])? --multiThread <numofthreads> --eachThreadOnePort --collectPredicateStatistics --collectClassStatistics --collectShapePropertyStatistics --checkPredicateSourceClass --collectForwardMultiplicity --collectReverseMultiplicity --executeSimplify --treatSubClassOfAsIntanceOf --removeOWLClasses --useClassPropertyRecoveryPerClass");
	  	System.out.println("example usage: java -jar RDF2Graph.jar <output directory> <admin:mypass@http://myserver:8080/db/query[http://example.com/basegraph] --multiThread 4 --collectPredicateStatistics --collectClassStatistics --collectForwardMultiplicity --executeSimplify");
	    System.out.println("Please see RDF2Graph manual for more details");
	  }
	}

	//Some predicates are not interesting for the structure recovery and should be excluded
	public boolean filterPredicate(String predicate)
	{
		return excludeProps.contains(predicate);//predicate.startsWith("http://www.w3.org/2002/07/owl#") && keepOWLClasses == false) ||
	}

	public void init() throws Exception
	{
		System.out.println("loading/creating local tdb database");
		localStore = new RDFSimpleCon("[http://ssb.wur.nl/RDF2Graph/]",this.project);
		System.out.println("loading/creating local tdb database done");
		localStore.setNsPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");
		localStore.setNsPrefix("rdfs","http://www.w3.org/2000/01/rdf-schema#");
		localStore.setNsPrefix("owl","http://www.w3.org/2002/07/owl#");
		localStore.setNsPrefix("core","http://purl.uniprot.org/core/");
		localStore.setNsPrefix("RDF2Graph","http://ssb.wur.nl/RDF2Graph/");
		localStore.setNsPrefix("rs","http://open-services.net/ns/core#");
		localStore.setNsPrefix("se","http://www.w3.org/2013/ShEx/Definition#");

		excludeProps.add(localStore.expand("rdf:type"));
		excludeProps.add(localStore.expand("rdf:first"));
		excludeProps.add(localStore.expand("rdf:rest"));
		excludeProps.add(localStore.expand("rdfs:domain"));
		excludeProps.add(localStore.expand("rdfs:range"));
		excludeProps.add(localStore.expand("rdf:object"));
		excludeProps.add(localStore.expand("rdf:predicate"));
		excludeProps.add(localStore.expand("rdf:subject"));
		excludeProps.add(localStore.expand("rdf:value"));

	  this.status = new StatusSystem(this.localStore);
	  this.status.init();
	  PoolingClientConnectionManager connectionPool = new PoolingClientConnectionManager();
	  connectionPool.setDefaultMaxPerRoute(this.numberOfThreads + 1);
	  connectionPool.setMaxTotal(this.numberOfThreads + 1);
	  HttpOp.setDefaultHttpClient(new DefaultHttpClient(connectionPool));
	  this.executer = new TaskExecuter(this.numberOfThreads);
	}

	public Main()
	{

	}
	public void run()
	{
		try
		{
			init();

		  //1. First get all the predicates present in the database
			if (!(status.stepDone("recoveryDone") || status.stepDone("1")))
			{
				System.out.println("Getting all predicates present in the database");
				for (ResultLine item : this.runRemoteQuery(remoteGraph2,"getAllPredicates.txt"))
				{
					String pred = item.getIRI("pred").toString();
					// exclude does properties that are there for describing the structure
					if (!filterPredicate(pred))
					{
						System.out.println("found predicate: " + pred);
						localStore.add(pred,"rdf:type","rdf:Property");
					}
				}
			  // 2. count for each predicate how often it occurs
				if(collectPredicateStatistics)
				{
				  for (ResultLine item : this.runLocalQuery(localStore,true,"getPredicates.txt"))
				  {
					  String pred = item.getIRI("pred");
					  System.out.println("counting number of triples with predicate: " + pred);
					  for (ResultLine item2 : this.runRemoteQuery(remoteGraph2,"countPredicate.txt",pred))
					  {
						  int count = item2.getLitInt("count");
						  System.out.println("count = " + count);
						  localStore.add(pred,"RDF2Graph:count",count);
				  	}
				  }
				}

			  //3. Source subject error checking: find for each predicate:
				//The number of source subjects that have no rdf:type defined and create an ErrorMsgObject
				//Those subjects are not reported in the reconstructed structure of the document
				if(checkPredicateSourceClass)
				{
					this.executer.runEachAsTask(this.runLocalQuery(localStore,true,"getPredicates.txt"),(ResultHandler)(ResultLine item,int index) -> {
					  String pred = item.getIRI("pred");
					  System.out.println("find and count number of subjects that have no rdf:type defined that are using the predicate: " + pred);
					  for (ResultLine item2 : this.runRemoteQuery(remoteGraph1,"testSourceTypesForPredicate.txt",pred))
					  {
						  int count = item2.getLitInt("count");
						  System.out.println("count = " + count);
						  if(count > 0)
						  {
						  	System.out.println("found predicate with source subject that has no type (RDF2Graph process may be incomplete)");
						    String errorObj = pred + "_error";
						    localStore.add(pred,"RDF2Graph:error",errorObj);
						    localStore.add(errorObj,"rdf:type","RDF2Graph:SourceNoTypeError");
						    localStore.add(errorObj,"RDF2Graph:count",count);
						  }
					  }
				  });
				}
				this.executer.finishAllFirst();

		  	//4. get all classes present in the database and create them as RDF2Graph:Class
				for (ResultLine item : this.runRemoteQuery(remoteGraph2,"getAllClasses.txt"))
				{
					String clazz = item.getIRI("class");
					//Skip owl:Class and rdfs:Class if we treat subClassOf as instanceOf
					if(this.treatSubClassOfAsIntanceOf && (clazz.equals("http://www.w3.org/2002/07/owl#Class") || clazz.equals("http://www.w3.org/2000/01/rdf-schema#Class")))
					  continue;
				  System.out.println("class: " + clazz);
					localStore.add(clazz,"rdf:type","RDF2Graph:Class");
				}

			  //5. get additional data for all the classes found in the database
				this.executer.runEachAsTask(this.runLocalQuery(localStore,true,"getFoundClasses.txt"),(ResultHandler)(ResultLine item,int index) -> {
				  String clazz = item.getIRI("class");
				  reconstructClass(clazz);
				});

				if(!useClassPropertyRecoveryPerClass)
				{
				  // * 5.2 collect for the specific class used predicate
				  // Get for this class all the outward going predicates (aka classProperty)
				  System.out.println("get properties for all classes ");
				  this.executer.runEachAsTask (this.runRemoteQuery(remoteGraph1,"getClassAllShapeProperties.txt"),(ResultHandler)(ResultLine item,int index) -> {
				  	String clazz = item.getIRI("type");
				  	String pred = item.getIRI("pred");
				  	if (this.filterPredicate(pred))
				  	{
				  		return;
				  	}
					  reconstructClassProperty(clazz,pred);
				  });
				}

				this.executer.finishAllFirst();

			 	//6. Get all the subClass of references into our database
		  	System.out.println("Loading all subClass of relationships");
		  	for(ResultLine item : this.runRemoteQuery(remoteGraph1,"getAllSubClassOf.txt"))
		  	{
		  		String child = item.getIRI("child");
		  		String parent = item.getIRI("parent");
					//System.out.println("class structure:" + parent + " -> " + child);
				  localStore.add(child,"rdfs:subClassOf",parent);
				}
		  	System.out.println("Loaded: all subClass of relationships");
				status.setStepDone("recoveryDone");
		 	}

		  //Clean owl classes
			cleanOWL();

		  this.includeStaticDefs();

		  //These steps has always to be executed
	    //Step 7.1 Mark classes with some instances and classes that have subclasses with some instances
	  	runUpdateQueryOnce(localStore,"clean2_project1.txt");
	  	runUpdateQueryOnce(localStore,"clean2_project2.txt");
		  //Step 7.2 Mark all concept classes
		  runUpdateQueryOnce(localStore,"clean8_insertConceptClasses1.txt");
		  runUpdateQueryOnce(localStore,"clean8_insertConceptClasses2.txt");
		  //7. The cleaning phase
		  if(executeSimplify && !(status.stepDone("executeSimplify")))
		  {
		  	this.simplify();
		  	cleanOWL();
		  	status.setStepDone("executeSimplify");
		  }

	    if(this.status.hasPredAsClassDetected())
	      System.out.println("Class as Predicate detected, note that the results might be invalid");
      System.out.println("recovery process completed");
		}
		catch(QuitException qe)
		{
			System.out.println("quited process will continue upon reactivation");
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		finally
		{
			try
			{
			  this.executer.finishAllFirst();
			}
			catch(Throwable th)
			{
				th.printStackTrace();
			}
			this.executer.close();
			this.localStore.close();
		}
	}

	private void cleanOWL()
	{
	  if(this.removeOWLClasses)
	  {
	  	System.out.println("cleaning OWL classes");
	  	localStore.runUpdateQuery("cleanOWL1.txt");
	  	localStore.runUpdateQuery("cleanOWL2.txt");
	  	localStore.runUpdateQuery("cleanOWL3.txt");
	  	localStore.runUpdateQuery("cleanOWL4.txt");
	  	localStore.runUpdateQuery("cleanOWL5.txt");
	  }
	}

	private void includeStaticDefs()
	{
		this.localStore.add("RDF2Graph:Class","rdfs:subClassOf","RDF2Graph:Type");
		this.localStore.add("RDF2Graph:Class","rdf:type","owl:Class");
		this.localStore.add("RDF2Graph:ConceptClass","rdf:type","owl:Class");
		this.localStore.add("RDF2Graph:Class","rdfs:subClassOf","rdfs:Class");
		this.localStore.add("RDF2Graph:ConceptClass","rdfs:subClassOf","rdfs:Class");
		this.localStore.add("RDF2Graph:Type","rdf:type","owl:Class");
		this.localStore.add("RDF2Graph:invalid","rdf:type","RDF2Graph:Invalid");
		this.localStore.add("RDF2Graph:Invalid","rdfs:subClassOf","RDF2Graph:Type");
		this.localStore.add("RDF2Graph:Invalid","rdf:type","owl:Class");
		this.localStore.add("RDF2Graph:externalref","rdf:type","RDF2Graph:ExternalReference");
		this.localStore.add("RDF2Graph:ExternalReference","rdfs:subClassOf","RDF2Graph:Type");
		this.localStore.add("RDF2Graph:ExternalReference","rdf:type","owl:Class");
		this.localStore.add("RDF2Graph:DataType","rdfs:subClassOf","RDF2Graph:Type");
		this.localStore.add("RDF2Graph:DataType","rdf:type","owl:Class");

		this.localStore.add("RDF2Graph:SourceNoTypeError","rdf:type","owl:Class");
		this.localStore.add("RDF2Graph:SourceNoTypeError","rdfs:subClassOf","RDF2Graph:Error");
		this.localStore.add("RDF2Graph:ClassAsPredicateError","rdf:type","owl:Class");
		this.localStore.add("RDF2Graph:ClassAsPredicateError","rdfs:subClassOf","RDF2Graph:Error");
		this.localStore.add("RDF2Graph:DestNoTypeError","rdf:type","owl:Class");
		this.localStore.add("RDF2Graph:DestNoTypeError","rdfs:subClassOf","RDF2Graph:Error");
		this.localStore.add("RDF2Graph:Error","rdf:type","owl:Class");
	}

	private void reconstructClass(String clazz) throws Exception
	{
		// 5.1 count the amount of instances that a present in the database for this class type
		if(this.collectClassStatistics && !localStore.contains(clazz,"RDF2Graph:count"))
		{
		  System.out.println("counting number of instances of class: " + clazz);
		  for (ResultLine item : this.runRemoteQuery(remoteGraph2,"countNumberOfClassInstances.txt",clazz))
		  {
			  int count = item.getLitInt("count");
			  System.out.println("count = " + count);
			  localStore.add(clazz,"RDF2Graph:count",count);
		  }
  	}

		// Get for this class all the outward going predicates (aka classProperty)
		System.out.println("check if class in not used as predicate: " + clazz);
		for (ResultLine item : this.runRemoteQuery(remoteGraph1,"checkClassIsNotPredicate.txt",clazz))
		{
			// pred == clazz
			System.out.println("Found class that is also used as predicate (RDF2Graph process may be incorrect)");
			String errorObj = clazz + "_clazz_error";
			localStore.add(clazz,"RDF2Graph:error",errorObj);
			localStore.add(errorObj,"rdf:type","RDF2Graph:ClassAsPredicateError");
			this.status.setPredAsClassDetected();
		}

		if(useClassPropertyRecoveryPerClass)
		{
		  // * 5.2 collect for the specific class used predicate
		  // Get for this class all the outward going predicates (aka classProperty)
		  System.out.println("get properties for class " + clazz);
		  this.executer.runEachAsTask (this.runRemoteQuery(remoteGraph1,"getClassShapeProperties.txt",clazz),(ResultHandler)(ResultLine item,int index) -> {
		  	String pred = item.getIRI("pred");
		  	if (this.filterPredicate(pred))
		  	{
		  		return;
		  	}
			  reconstructClassProperty(clazz,pred);
		  });
		}
	}

	//Make sure that we keep uniq iris if we build them from a parent en child iri
	private String buildUniqIri(String parentIri,String childIri)
	{
		String key = parentIri.replace('#','/') + childIri.substring(Math.max(childIri.replace('#','/').lastIndexOf('/'),0));
		String key2 = parentIri.replace('#','/') + childIri;
		LinkedList<String> list = keepUniq.get(key);
		if(list == null)
		{
			list = new LinkedList<String>();
		  list.add(key2);
			keepUniq.put(key,list);
			return key;
		}
		int index = list.indexOf(key2);
		if(index == -1)
		{
			index = list.size();
			list.add(key2);
		}
		if(index > 0)
			key += "/" + index;
		return key;
	}

	private String createClassProperty(String clazz,String predicate,String uniq)
	{
		String classProperty = buildUniqIri(clazz,predicate) + uniq;
		localStore.add(classProperty,"rdf:type","RDF2Graph:ClassProperty");
		//graph.add(classProperty,"rdf:type","owl:Class");
		localStore.add(classProperty,"RDF2Graph:rdfProperty",predicate);
		localStore.add(clazz,"RDF2Graph:property",classProperty);
		//graph.add(clazz,"rdfs:subClassOf",classProperty);
		return classProperty;
	}

	private String createTypeLink(String classProperty,String uniq,int count)
	{
		String typeLink = classProperty + "/" +uniq + count++;
		localStore.add(typeLink,"rdf:type","RDF2Graph:TypeLink");
		localStore.add(classProperty,"RDF2Graph:linkTo",typeLink);
		return typeLink;
	}

	private String createDestError(String typeLink,String predicate,String uniq)
	{
		String errorObj = typeLink + "_error" + uniq;
		localStore.add(typeLink,"RDF2Graph:error",errorObj);
		localStore.add(errorObj,"rdf:type","RDF2Graph:DestNoTypeError");
		localStore.add(predicate,"RDF2Graph:error",errorObj);
   	//extra ref from object to predicate object
		//graph.add(errorObj,"RDF2Graph:predicate",predicate);

		return errorObj;
	}

	private void reconstructClassProperty(String clazz,String predicate) throws Exception
	{
		System.out.println("Found property: " + predicate + " for shape: " + clazz);
		//Create the classproperty
		String classProperty = createClassProperty(clazz,predicate,"");

		// * 5.3.1 get for each class/prop combi the types it references
		// Each type that is referenced generates one seperate shape property
		int resCount = this.executer.runEachAsTask(this.runRemoteQuery(remoteGraph1,"getClassPropertyDetails.txt",clazz,predicate),(ResultHandler)(ResultLine item,int count) -> {
			System.out.println("Type link found" + predicate + " for shape: " + clazz + " #" + count);
			String typeLink = createTypeLink(classProperty,"o",count);
			String refType = item.getIRI("refType");
			String xsdType = item.getIRI("xsdType");

			//If we have no type associated it can be either an subject which has not class or be reference to external resource
			if (refType == null && xsdType == null)
			{
				System.out.println("No type found checking if its a external reference");
				if(this.runRemoteQuery(remoteGraph1,"checkClassPropertyExternalRef.txt",clazz,predicate).iterator().hasNext())
				{
					System.out.println("Referencing to a subject, which is not typed, report error");
					localStore.add(typeLink,"RDF2Graph:type","RDF2Graph:invalid");
					createDestError(typeLink,predicate,"");
				}
				else
				{
					System.out.println("It is a external reference");
					localStore.add(typeLink,"RDF2Graph:type","RDF2Graph:externalref");
					recoverTypelink(clazz,typeLink,predicate,"rdfs:Resource","exref");
				}
			}
			else if(refType != null)
			{
				System.out.println("Referencing to shape: " + refType);
				localStore.add(typeLink,"RDF2Graph:type",refType);
				recoverTypelink(clazz,typeLink,predicate,refType,"ref");
			}
			else
			{
				System.out.println("DataType property found of type: " + xsdType);
				localStore.add(typeLink,"RDF2Graph:type",xsdType);
				localStore.add(xsdType,"rdf:type","RDF2Graph:DataType");
				recoverTypelink(clazz,typeLink,predicate,xsdType,"simple");
			}
		});
		if(resCount == 0)
			throw new Error("Class property that has no ref to types");
	}

	private void recoverTypelink(String clazz,String typeLink,String predicate,String toType,String suffix) throws Exception
	{
		// 5.3.1.1 collect statistics for the shape property
		if(this.collectShapePropertyStatistics)
		{
			System.out.println("counting number of occurrences for the shape property");
			for (ResultLine item : this.runRemoteQuery(remoteGraph1,"getShapePropertyCount_" + suffix + ".txt",clazz,predicate,toType))
			{
				int count = item.getLitInt("count");
				System.out.println("count = " + count);
				localStore.add(typeLink,"RDF2Graph:count",count);
			}
		}
		// 5.3.1.2 collect forward multiplicity for the property
		if(this.collectForwardMultiplicity)
		{
		  System.out.println("Getting maximum forward multiplicity");
		  int max = 0;
		  int min = 1;
		  for (ResultLine item : this.runRemoteQuery(remoteGraph1,"getShapePropertyForwardMaxMultiplicity_" + suffix + ".txt",clazz,predicate,toType))
		  {
			  max = item.getLitInt("max");
	  	}
	  	System.out.println("Getting minimum forward multiplicity");
	  	for (ResultLine item : this.runRemoteQuery(remoteGraph1,"getShapePropertyForwardMinMultiplicity_" + suffix + ".txt",clazz,predicate,toType))
		  {
			  min = 0;
	  	}

	  	String multiplicy = getMultiplicity(min,max);
		  System.out.println("forward multiplicity: " + multiplicy);
		  localStore.add(typeLink,"RDF2Graph:forwardMultiplicity",multiplicy);
		}
		// 5.2.1.3 collect reverse multiplicity for the property
		if(this.collectReverseMultiplicity)
		{
		  System.out.println("Getting maximum reverse multiplicity");
		  int max = 0;
		  int min = 1;
		  if(suffix == "ref" || suffix == "exref" || (suffix == "simple" && toType.equals("http://www.w3.org/2001/XMLSchema#string")))
		  {
		    for (ResultLine item : this.runRemoteQuery(remoteGraph1,"getShapePropertyReverseMaxMultiplicity_" + suffix + ".txt",clazz,predicate,toType))
		    {
			    max = item.getLitInt("max");
	  	  }
		  }
		  else
		  {
		  	//Max reverse multiplicity makes no sense for simples such as date, integer, float etc
		  	max = -1;
		  }
	  	System.out.println("Getting minimum reverse multiplicity");
	    //not possible to check for simple types or external references so set in to invalid
	  	//as there are always simples or external references that are not reference by our classProperty
	  	if(suffix == "ref")
	  	{
	  	  for (ResultLine item : this.runRemoteQuery(remoteGraph1,"getShapePropertyReverseMinMultiplicity_ref.txt",toType,predicate,clazz))
		    {
			    min = 0;
	  	  }
	  	}
	  	else
	  	{
	  		min = -1;
	  	}

	  	String multiplicy = getMultiplicity(min,max);
	  	System.out.println("reverse multiplicity: " + multiplicy);
		  localStore.add(typeLink,"RDF2Graph:reverseMultiplicity",multiplicy);
		}
	}

	private String getMultiplicity(int min,int max) throws Exception
	{
	  if (max == 1 && min == 1)
		  return "rs:Exactly-one";
	  else if (max > 1 && min == 1)
	  	return "rs:One-or-many";
  	else if (max > 1 && min == 0)
  		return "rs:Zero-or-many";
	  else if (max == 1 && min == 0)
	  	return "rs:Zero-or-one";
	  else if (min == -1 && max == 1)
	  	return "RDF2Graph:x_1";
	  else if (min == -1 && max > 1)
	  	return "RDF2Graph:x_n";
	  else if (max == -1 && min == -1)
	  	return "RDF2Graph:none";
	  else
	  {
	  	System.out.println("ERROR: unknow multiplicy type: min = " + min + " max = " + max);
	  	return "RDF2Graph:none";
		//  throw new Exception("unknow multiplicy type: min = " + min + " max = " + max);
	  }
	}
	private int getMax(String multiplicity)
	{
		if(multiplicity == null)
			return -1;
		if(multiplicity.equals("http://open-services.net/ns/core#Exactly-one"))
			return 1;
		else if(multiplicity.equals("http://open-services.net/ns/core#One-or-many"))
			return 2;
		else if(multiplicity.equals("http://open-services.net/ns/core#Zero-or-many"))
			return 2;
		else if(multiplicity.equals("http://open-services.net/ns/core#Zero-or-one"))
			return 1;
		else if(multiplicity.equals("http://ssb.wur.nl/RDF2Graph/x_1"))
			return 1;
		else if(multiplicity.equals("http://ssb.wur.nl/RDF2Graph/x_n"))
			return 2;
		else if(multiplicity.equals("http://ssb.wur.nl/RDF2Graph/none"))
			return -1;
		throw new RuntimeException("unknown multiplicity " + multiplicity);
	}
	private int getMin(String multiplicity)
	{
		if(multiplicity == null)
			return -1;
		else if(multiplicity.equals("http://open-services.net/ns/core#Exactly-one"))
			return 1;
		else if(multiplicity.equals("http://open-services.net/ns/core#One-or-many"))
			return 1;
		else if(multiplicity.equals("http://open-services.net/ns/core#Zero-or-many"))
			return 0;
		else if(multiplicity.equals("http://open-services.net/ns/core#Zero-or-one"))
			return 0;
		else if(multiplicity.equals("http://ssb.wur.nl/RDF2Graph/none") || multiplicity.equals("http://ssb.wur.nl/RDF2Graph/x_1") || multiplicity.equals("http://ssb.wur.nl/RDF2Graph/x_n"))
			return -1;
		throw new RuntimeException("unknown multiplicity " + multiplicity);
	}

	private void simplify() throws Exception
	{
	  //Step 7.2
	  Tree tree = buildTree();
	  //Step 7.3
	  tree.calculateSubClassOfIntanceOfCount();
	  storeClassProps(tree);
	  //Step 7.4
	  for (ResultLine item : this.runLocalQuery(localStore,true,"clean4_getAllProps.txt"))
  	{
		  String property = item.getIRI("property");
	    simplifyForProperty(tree,property);
	  }
	  //Step 7.5
	  runUpdateQueryOnce(localStore,"clean6_removeAllShapeProps1.txt");
	  runUpdateQueryOnce(localStore,"clean7_removeAllShapeProps2.txt");
	}

	private void simplifyForProperty(Tree tree,String property) throws Exception
	{
		//step 7.4.1: Step 1 of simplification process
		System.out.println("performing simplification for property: " + property);
		System.out.println("loading property information into the tree");
		for (ResultLine item : this.runLocalQuery(localStore,true,"clean5_getAllShapeProps.txt",property))
		{
			String source = item.getIRI("source");
			String type = item.getIRI("type");
			if(source == null || type == null)
				throw new RuntimeException("source or dest of shape property is null");
			int count = item.getLitInt("count",0);
			String forwardMultiplicity = item.getIRI("forwardMultiplicity");
			String reverseMultiplicity = item.getIRI("reverseMultiplicity");;
			TreeNode sourceNode = tree.getNode(source);
			if(sourceNode == null)
			{
				System.out.println("source node not found: " + source);
				sourceNode = tree.createMissingNode(source,tree);
			}
			sourceNode.addTemporaryLink(type,count,this.getMin(forwardMultiplicity),this.getMax(forwardMultiplicity),this.getMin(reverseMultiplicity),this.getMax(reverseMultiplicity));
		}
		tree.prepTemporaryLinks();
		printTemporaryLinks(tree);
		//step 7.4.2
		System.out.println("step 1");
		if(property.equals("http://ssb.wur.nl/RDF2Graph/rdfProperty"))
			System.out.println("debug");
		tree.simplifyStep2();
		printTemporaryLinks(tree);
	  //step 7.4.3
		System.out.println("step 2");
		tree.simplifyStep3();
		printTemporaryLinks(tree);
	  //step 7.4.4
		System.out.println("step 3");
		tree.simplifyStep4();
		printTemporaryLinks(tree);
		//write new properties to database
		//step 7.4.5
		storeNewUniqueTypeLinks(tree,property);
		System.out.println("clean tree");
		tree.clean();
	}

	private void printTemporaryLinks(Tree tree)
	{
		for(TreeNode node : tree.getAllNodes())
		{
			for(UniqueTypeLink dest : node.getTemporaryLinks())
			{
				System.out.println(node.name + " ---> " + dest.typeName);
			}
		}
	}

	private void storeClassProps(Tree tree)
	{
		for(TreeNode node : tree.getAllNodes())
		{
			if(node.isRoot()) //do not export root object
				continue;
			String clazz = node.name;
			int count = node.getSubClassOffInstanceCount();
			assert(count != -2);
			if(count != -1)
			  localStore.add(clazz,"RDF2Graph:subClassOfInstanceCount",count);
		}
	}

	private void storeNewUniqueTypeLinks(Tree tree,String predicate) throws Exception
	{
		int count = 1;
		for(TreeNode node : tree.getAllNodes())
		{
			for(UniqueTypeLink dest : node.getTemporaryLinks())
			{
				String sourceType = node.name;
				String typeName = dest.typeName;
				String classProperty = createClassProperty(sourceType,predicate,"_n");
				String typeLink = createTypeLink(classProperty,"n",count++);

				localStore.add(typeLink,"RDF2Graph:type",typeName);
				localStore.add(typeLink,"RDF2Graph:count",dest.count);
			  localStore.add(typeLink,"RDF2Graph:forwardMultiplicity",this.getMultiplicity(dest.forwardMinMultiplicity,dest.forwardMaxMultiplicity));
			  localStore.add(typeLink,"RDF2Graph:reverseMultiplicity",this.getMultiplicity(dest.reverseMinMultiplicity,dest.reverseMaxMultiplicity));
			  //note them as new so they do not get deleted
			  localStore.addLit(classProperty,"RDF2Graph:noteAsNew","new");

			  if(typeName.equals(localStore.expand("RDF2Graph:invalid")))
			  {
				  createDestError(typeLink,predicate,"_n");
			  }
			}
		}
	}

	private Tree buildTree() throws Exception
	{
		System.out.println("building the subclassOf tree");
		Tree tree = new Tree();
		for (ResultLine item : this.runLocalQuery(localStore,true,"clean3_getTree.txt"))
		{
			String parent = item.getIRI("parent");
			String child = item.getIRI("child");
			int childCount = item.getLitInt("childCount",-2);
			int parentCount = item.getLitInt("parentCount",-2);
			System.out.println("parent = " + parent + " child = " + child);
      tree.buildLink(parent,parentCount,child,childCount);
		}
    tree.finish();
		System.out.println("building the subclassOf tree done");
		return tree;
	}

	private String readFile(String file) throws IOException
	{
		File inFile = new File(file);
		FileInputStream input = new FileInputStream(inFile);
		byte all[] = new byte[(int)inFile.length()];
		input.read(all);
		String string = new String(all);
		input.close();
		return string;
	}

	public Query getQuery(String file,Object ... args)
	{
		try
		{
			String header = this.readFile("queries/header.txt");
			String content = this.readFile(file);
			String query = header + content;
			query = String.format(query,args);
			return QueryFactory.create(query);
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		return null;
	}
  private Iterable<ResultLine> runRemoteQuery(RDFSimpleCon graph,String queryFile,Object ... args) throws Exception
  {
    long millis = System.currentTimeMillis();
    if(treatSubClassOfAsIntanceOf)
    	queryFile = "remoteSubClassOf/" + queryFile;
    else
    	queryFile = "remote/" + queryFile;
    Iterable<ResultLine> toRet = graph.runQuery(queryFile,true,args);
	  System.out.println("time: " + (System.currentTimeMillis() - millis) + " for query " + queryFile);
	  return toRet;
  }

  private Iterable<ResultLine> runLocalQuery(RDFSimpleCon graph,boolean preload,String queryFile,Object ... args) throws Exception
  {
	  return graph.runQuery("local/" + queryFile,true,args);
  }

	private void runUpdateQueryOnce(RDFSimpleCon graph,String file,Object ...args)
	{
	  if(!graph.containsLit("RDF2Graph:status","RDF2Graph:updatePerformed",file))
	 	{
	  	System.out.println("running update query " + file);
	  	graph.runUpdateQuery(file,args);
	  	graph.addLit("RDF2Graph:status","RDF2Graph:updatePerformed",file);
	 	}
	}
	private void runUpdateQueryOnceA(RDFSimpleCon graph,String file,Object ...args)
	{
	  System.out.println("DEV: running update query " + file);
	  graph.runUpdateQuery(file,args);
	  graph.addLit("RDF2Graph:status","RDF2Graph:updatePerformed",file);
	}
}


text:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>sap.m.DateTimeInput</title>

<script src="shared-config.js"></script>
<script src="../../../resources/sap-ui-core.js"
	id="sap-ui-bootstrap" data-sap-ui-libs="sap.m">
</script>

<script>
	var nNow = new Date().getTime(),
		list, oListWithTypes,
		oModel = new sap.ui.model.json.JSONModel();

	oModel.setData({
		// same value with different object
		dateVal1 : new Date(nNow),
		dateVal2 : new Date(nNow),
		dateVal3 : new Date(nNow),
		dateVal4 : new Date(nNow),
		dateVal5 : new Date(nNow)
	});
	sap.ui.getCore().setModel(oModel);

	var iEvent = 0;
	function handleChange(oEvent){
		var oDTI = oEvent.oSource;
		var oInput = sap.ui.getCore().byId("I2");
		var sValue = oEvent.getParameter("value");
		var bValid = oEvent.getParameter("valid");
		iEvent++;
		oInput.setValue("Change - Event " + iEvent + ": DateTimeInput " + oDTI.getId() + ":" + sValue + " ;valid: " + bValid);
		if (bValid) {
			oDTI.setValueState(sap.ui.core.ValueState.None);
		} else {
			oDTI.setValueState(sap.ui.core.ValueState.Error);
		}
	};

	sap.ui.getCore().attachParseError(
			function(oEvent) {
				var oElement = oEvent.getParameter("element");
				var sProperty = oEvent.getParameter('property');
				var oValue = oEvent.getParameter('newValue');
				var oType = oEvent.getParameter('type');
				var oOldValue = oEvent.getParameter('oldValue');

				var oInput = sap.ui.getCore().byId("I2");
				oInput.setValue( "ParseError: Entered value: "+oValue);

				if (oElement.setValueState) {
					oElement.setValueState(sap.ui.core.ValueState.Error);
				}
			});

	sap.ui.getCore().attachValidationSuccess(
			function(oEvent) {
				var oElement = oEvent.getParameter("element");
				var sProperty = oEvent.getParameter('property');
				var oValue = oEvent.getParameter('newValue');
				var oType = oEvent.getParameter('type');
				var oOldValue = oEvent.getParameter('oldValue');

				var oInput = sap.ui.getCore().byId("I2");
				oInput.setValue( "ValidationSuccess: Entered value: "+oValue);

				if (oElement.setValueState) {
					oElement.setValueState(sap.ui.core.ValueState.None);
				}
			});

	var page = new sap.m.Page({
		title : "DateTimeInput Controls",
		enableScrolling : true,
		content : [
			list = new sap.m.List({
				inset : false,
				width : "100%",
				items : [
					new sap.m.InputListItem({
						label : "Christmas",
						content : oDTI1 = new sap.m.DateTimeInput("DTI1", {
							placeholder : "Date Picker",
							change : function(e) {
								var oDate = e.getParameters().newDateValue;
								if (oDate && oDate.getMonth() == 11 && oDate.getDate() == 25) {
									oDTI1.setValueState("None");
								} else {
									oDTI1.setValueState("Error");
								}
							}
						})
					}), new sap.m.InputListItem({
						label : "Duration",
						content : oDTI2 = new sap.m.DateTimeInput("DTI2", {
							placeholder : "Time Picker",
							type : "Time",
							valueFormat : "HH:mm",
							value : "11:23",
							displayFormat : "H'h' m'm'",
							change : handleChange
						})
					}), new sap.m.InputListItem({
						label : "DateTime",
						content : oDTI3 = new sap.m.DateTimeInput("DTI3", {
							placeholder : "DateTime",
							type : "DateTime",
							change : handleChange
						})
					})
				]
			}),

			// free style date value assingment according to valueFormat
			oDTI4 = new sap.m.DateTimeInput("DTI4", {
				value : "29-05, 2012",
				valueFormat : "dd-MM, yyyy",
				displayFormat : "dd MMMM, yyyy",
				width : "20%",
				change : handleChange
			}),

			// formats which includes zones "Z" can be used for local date time
			oDTI5 = new sap.m.DateTimeInput("DTI5", {
				width : "99%",
				type : "DateTime",
				displayFormat : new sap.ui.model.type.DateTime({style: "long"}).getOutputPattern(),
				dateValue : new Date(2012, 4, 29, 19, 14, 0),
				valueState : "Warning",
				change : handleChange
			}),

			// data binding usage
			oDTI6 = new sap.m.DateTimeInput("DTI6", {
				value : {
					path : "/dateVal1",
					type : new sap.ui.model.type.Date({strictParsing: true})
				}
			}),
			oI1 = new sap.m.Input("I1", {
				value: {
					path: "/dateVal1",
					type: new sap.ui.model.type.Date({style: "long", strictParsing: true})
					},
				editable: false
			}),
			oDTI7 = new sap.m.DateTimeInput("DTI7", {
				value : {
					path : "/dateVal2",
					type : new sap.ui.model.type.Date({pattern : "E dd, MMMM yyyy", strictParsing: true})
				},
				change : handleChange
			}),
			oDTI8 = new sap.m.DateTimeInput("DTI8", {
				value : {
					path : "/dateVal3",
					type : new sap.ui.model.type.Date({style : "short", strictParsing: true})
				}
			}),
			oDTI9 = new sap.m.DateTimeInput("DTI9", {
				type : "Time",
				editable : false,
				value : {
					path : "/dateVal4",
					type : new sap.ui.model.type.Time({style : "medium", strictParsing: true})
				}
			}),
			oDTI10 = new sap.m.DateTimeInput("DTI10", {
				type : "DateTime",
				enabled : false,
				value : {
					path : "/dateVal5",
					type : new sap.ui.model.type.DateTime({style : "medium", strictParsing: true})
				}
			}),
			new sap.m.Input("I2", {value: "Content of events DateTimeInput", editable: false}),
			/*Table examinating different combination beetween DateTimeInput's type property and binding pattern of 'value'*/
			oListWithTypes = new sap.m.Table({
				inset: true,
				headerText: "Databinding type vs DateTypeInput type",
				columns: [
					new sap.m.Column({
						header: new sap.m.Label({text: "'type' property"})
					}),
					new sap.m.Column({
						header: new sap.m.Label({text: "Supported bindings"})
					}),
					new sap.m.Column({
						header: new sap.m.Label({text: "DateTimeInput"})
					}),
					new sap.m.Column({
						header: new sap.m.Label({text: "Input bound to the same model property, without binding type"})
					})
				],
				items : [
					new sap.m.ColumnListItem({
						cells: [
							new sap.m.Select({
								items: [
									new sap.ui.core.Item({text: "sap.m.DateTimeInputType.Date", key: sap.m.DateTimeInputType.Date}),
									new sap.ui.core.Item({text: "sap.m.DateTimeInputType.Time", key: sap.m.DateTimeInputType.Time}),
									new sap.ui.core.Item({text: "sap.m.DateTimeInputType.DateTime", key: sap.m.DateTimeInputType.DateTime})
								],
								selectedKey: sap.m.DateTimeInputType.Date,
								change: function(oEvent) {
									var oSelectedItem = oEvent.getParameter("selectedItem"),
										oDateTimeInput = oEvent.getSource().getParent().getCells()[2];
									oDateTimeInput.setType(oSelectedItem.getKey(), "string");
								}
							}),
							new sap.m.Select({
								items: [
									new sap.ui.core.Item({text: "sap.ui.model.type.Date", key: "sap/ui/model/type/Date"}),
									new sap.ui.core.Item({text: "sap.ui.model.type.Time", key: "sap/ui/model/type/Time"}),
									new sap.ui.core.Item({text: "sap.ui.model.type.DateTime", key: "sap/ui/model/type/DateTime"}),
									new sap.ui.core.Item({text: "sap.ui.model.odata.type.DateTimeOffset", key: "sap/ui/model/odata/type/DateTimeOffset"}),
								],
								selectedKey: "sap/ui/model/type/Date",
								change: function(oEvent) {
									var oSelectedItem = oEvent.getParameter("selectedItem"),
											oDateTimeInput = oEvent.getSource().getParent().getCells()[2],
											oBI = oDateTimeInput.getBinding("value"),
											fnClass = sap.ui.requireSync(oSelectedItem.getKey()),
											oClass = new fnClass();
									oBI.setType(oClass, "string");
									oDateTimeInput.rerender();
								}
							}),
							new sap.m.DateTimeInput("DTIBinding",{
								type: sap.m.DateTimeInputType.Date,
								value: {path: "/dateVal1", type: new sap.ui.model.type.Date()}
							}).setModel(oModel),
							new sap.m.Input({value:{path: "/dateVal1"}}).setModel(oModel)
						],
					})
				]
			})
		]
	});

	new sap.m.App().addPage(page).placeAt("body");
</script>
</head>
<body id="body" class="sapUiBody">
</body>
</html>


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TextView android:id="@+id/footview_tv_charge_note"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:paddingLeft="10dp"
        android:paddingTop="10dp"
        android:textSize="16sp"/>

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
        <TextView android:id="@+id/footview_left"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:textSize="16sp"
            android:paddingLeft="10dp"
            android:paddingBottom="10dp"/>

        <TextView android:id="@+id/footview_right"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:textSize="16sp"/>
    </LinearLayout>

</LinearLayout>


text:
<!-- Begin Search Bar Toggle Script-->
	<script type="text/javascript">

	$(function(){
		$(".searchbar").hide();

		$(".searchicon").on("click",
			function(){

				if( $( ".searchbar" ).is( ":hidden" ) ) {

				    $(".navbutton, .searchbar").toggle(300);
				    $(".searchicon").css("background-color", "#196143");

				    return;

				}

				else if ( $( ".navbutton" ).is( ":hidden" ) ) {

					$(".searchbar, .navbutton").toggle(300);
					$(".searchicon").css("background-color", "transparent");
					$('.searchicon').hover(
					    function() {
					      var $this = $(this);
					      $this.data('transparent', $this.css('background-color')).css('background-color', '#196143');
					    },
					    function() {
					      var $this = $(this);
					      $this.css('background-color', $this.data('transparent'));
					    }
					);

				}
		});

	});
	</script>
<!-- End Search Bar Toggle Script -->


text:
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""

if __name__ == '__main__':
    from os import getcwd
    from os import sys
    sys.path.append(getcwd())

from MOAL.helpers.display import Section
from MOAL.helpers.display import print_h2
from MOAL.helpers.adts import list_fill
import time

DEBUG = True if __name__ == '__main__' else False

def _check_degenerates(s1, s2):
    """
    "In mathematics, a degenerate case is a limiting case in which an element
    of a class of objects is qualitatively different from the rest of the class
    and hence belongs to another, usually simpler, class."
    -Wikipedia

    The degenerates here are strings that are equal; these are not in the class
    of strings that need comparison by Levenshtein distance.
    """
    if s1 == s2:
        return 0
    if len(s1) == 0:
        return len(s2)
    if len(s2) == 0:
        return len(s1)
    return None

def _branch(word, dist):
    # TODO: move into re-usable recursion visualization function
    # (from original drawings of an abstract diagram for recursion.)
    chars = len(word)
    word = '{}'.format('\\' + ('_' * chars * 2) + word if dist == 1 else word)
    hline = chars * '_'
    branch = '{}'.format('' * chars if dist == 1 else '{}/'.format(hline))
    return branch, word

def lev_recursive(s1, s2, l1=None, l2=None, ct=0):
    """Recursive implementation of the Levenshtein distance algorithm.
    Algorithm from Wikipedia pseudocode:
    wikipedia.org/wiki/Levenshtein_distance#Computing_Levenshtein_distance
    Canonical math example, but not useful for real implementations.
    """
    basic = _check_degenerates(s1, s2)
    if basic is not None:
        return basic
    dist = 0
    # Get length of both strings
    if l1 is None and l2 is None:
        l1, l2 = len(s1), len(s2)
    # Return the other string if one is zero, and vice versa.
    if l1 == 0:
        return l2
    if l2 == 0:
        return l1
    # Compare last characters of both cost increases if they're not equal.
    cost = 0 if s1[::-1] == s2[::-1] else 1
    # Perform the distance function by returning three calls recursively
    # per operation, to determine the offset of the three scenarios:
    # short s1, short s2
    dist = min(
        lev_recursive(s1, s2, l1=l1 - 1, l2=l2, ct=ct + 1) + 1,
        lev_recursive(s1, s2, l1=l1, l2=l2 - 1, ct=ct + 2) + 1,
        lev_recursive(s1, s2, l1=l1 - 1, l2=l2 - 1, ct=ct + 3) + cost)
    if DEBUG:
        # A visualization of the recursive call graph and the various
        # parent/child branches that result in the duplicate
        # (and unnecessary) calculations.
        word = s1[0:l1] + s2[0:l2]
        text = '"{}" and "{}" = {}'.format(s1, s2, dist)
        # Get the branch/leaf style based on whether it was the root
        # or child node in each call graph.
        branch, word = _branch(word, dist)
        # With the combination of a time delay and the branching
        # visualization, I hope to drive home the realization of how
        # terribly inefficient this algorithm is.
        time.sleep(0.01)
        branching = '{}{}{}'.format('  ' * ct, word, branch)
        print('({}) {}'.format(text, branching))
    return dist

def lev_iterative(s1, s2):
    """The iterative approach to the Levenshtein algorithm.
    Code is ported from (pseudo-code? c?) example on Wikipedia:
    wikipedia.org/wiki/Levenshtein_distance#Iterative_with_two_matrix_rows

    One important thing to note: the Levenshtein function is NOT transitive,
    so order matters! That is, lev(s1, s2) != lev(s2, s1).
    """
    basic = _check_degenerates(s1, s2)
    if basic is not None:
        return basic
    v1, v2 = list_fill(len(s2) + 1, fill=0), list_fill(len(s2) + 1, fill=0)
    len1, len2, lenv1 = len(s1), len(s2), len(v1)

    for i in range(0, len2):
        v1[i] = i

    for i in range(0, len1):
        v2[0] = i + 1
        for j in range(0, len2):
            cost = 0 if s1[i] == s2[j] else 1
            v2[j + 1] = min(v1[j] + 1, v1[j + 1] + 1, v1[j] + cost)
        for _j in range(0, lenv1):
            v1[_j] = v2[_j]

    dist = v2[len2]
    print('Levenshtein distance of "{}" and "{}" is {}'.format(s1, s2, dist))
    return dist

if __name__ == '__main__':
    with Section('Algorithms / coding theory - Levenshtein distance'):
        print_h2('Levenshtein distance', 'recursive')
        lev_recursive('mop', 'pop')

        print_h2('Levenshtein distance', 'iterative')
        pairs = [
            ('slaughter', 'laughter'), ('flower', 'power'),
            ('liliputian', 'brobdingnagian'),
            ('sitting', 'kitten'),
            ('gargantua', 'pentagruel'),
        ]
        for pair in pairs:
            lev_iterative(*pair)


text:
package fp;

import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;

public final class Either<L,R>
{
    public static <L,R> Either<L,R> left(L value) {
        return new Either<>(Optional.of(value), Optional.empty());
    }
    public static <L,R> Either<L,R> right(R value) {
        return new Either<>(Optional.empty(), Optional.of(value));
    }
    private final Optional<L> left;
    private final Optional<R> right;
    private Either(Optional<L> l, Optional<R> r) {
      left=l;
      right=r;
    }
    public <T> T map(
        Function<? super L, ? extends T> lFunc,
        Function<? super R, ? extends T> rFunc)
    {
        return left.<T>map(lFunc).orElseGet(()->right.map(rFunc).get());
    }
    public <T> Either<T,R> mapLeft(Function<? super L, ? extends T> lFunc)
    {
        return new Either<>(left.map(lFunc),right);
    }
    public <T> Either<L,T> mapRight(Function<? super R, ? extends T> rFunc)
    {
        return new Either<>(left, right.map(rFunc));
    }
    public void apply(Consumer<? super L> lFunc, Consumer<? super R> rFunc)
    {
        left.ifPresent(lFunc);
        right.ifPresent(rFunc);
    }
}


text:
A little morse code translator in node/express

It supports A-Z 0-9


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
 ~ Copyright (c) WSO2 Inc. (http://wso2.com) All Rights Reserved.
 ~
 ~ 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <parent>
        <groupId>org.wso2.iot</groupId>
        <artifactId>wso2iot-p2-profile</artifactId>
        <version>3.1.1-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>wso2iot-broker-p2-profile</artifactId>
    <packaging>pom</packaging>
    <name>WSO2 IoT - Broker P2 Profile Gen</name>
    <url>http://wso2.com/products/message-broker/</url>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>unpack-equinox-executable</id>
                        <phase>test</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.eclipse.equinox</groupId>
                                    <artifactId>org.eclipse.equinox.executable</artifactId>
                                    <version>3.5.0.v20110530-7P7NFUFFLWUl76mart</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>2-unpack-wso2carbon</id>
                        <phase>test</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.wso2.carbon</groupId>
                                    <artifactId>wso2carbon-core</artifactId>
                                    <version>${carbon.kernel.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.wso2.maven</groupId>
                <artifactId>carbon-p2-plugin</artifactId>
                <version>${carbon.p2.plugin.version}</version>
                <executions>
                    <execution>
                        <id>2-p2-repo-generation</id>
                        <phase>package</phase>
                        <goals>
                            <goal>p2-repo-gen</goal>
                        </goals>
                        <configuration>
                            <metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
                            <artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
                            <publishArtifacts>true</publishArtifacts>
                            <publishArtifactRepository>true</publishArtifactRepository>
                            <featureArtifacts>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.logging.mgt.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.analytics-common:org.wso2.carbon.databridge.datapublisher.feature:${carbon.analytics.common.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.system.statistics.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.soaptracer.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity.framework:org.wso2.carbon.security.mgt.feature:${carbon.identity.framework.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.message.flows.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.tryit.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.registry:org.wso2.carbon.registry.core.feature:${carbon.registry.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.registry:org.wso2.carbon.registry.contentsearch.feature:${carbon.registry.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.registry:org.wso2.carbon.registry.resource.properties.feature:${carbon.registry.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.wsdl.tools.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity.user.ws:org.wso2.carbon.um.ws.service.feature:${carbon.um.ws.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.messaging:org.wso2.carbon.andes.feature:${carbon.messaging.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.multitenancy:org.wso2.carbon.tenant.common.server.feature:${carbon.multitenancy.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.tenant.mgt.common.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.multitenancy:org.wso2.carbon.tenant.usage.agent.feature:${carbon.multitenancy.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.multitenancy:org.wso2.carbon.tenant.throttling.agent.feature:${carbon.multitenancy.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.multitenancy:org.wso2.carbon.tenant.deployment.feature:${carbon.multitenancy.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity.carbon.auth.saml2:org.wso2.carbon.identity.authenticator.saml2.sso.feature:${identity.carbon.auth.saml2.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity.framework:org.wso2.carbon.user.mgt.feature:${carbon.identity.framework.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity.framework:org.wso2.carbon.identity.core.feature:${carbon.identity.framework.version}
                                </featureArtifactDef>
                                <!--carbon core features -->
                                <featureArtifactDef>
                                    org.wso2.carbon:org.wso2.carbon.core.feature:${carbon.kernel.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon:org.wso2.carbon.core.runtime.feature:${carbon.kernel.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.messaging:org.wso2.carbon.messaging.metrics.feature:${carbon.messaging.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.metrics:org.wso2.carbon.metrics.feature:${carbon.metrics.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.ciphertool:org.wso2.ciphertool.feature:${cipher.tool.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.analytics.shared:org.wso2.carbon.analytics.shared.data.agents.log4j.feature:${analytics.shared.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature:${carbon.device.mgt.plugin.version}
                                </featureArtifactDef>
                            </featureArtifacts>
                        </configuration>
                    </execution>
                    <execution>
                        <id>publishing products</id>
                        <phase>package</phase>
                        <goals>
                            <goal>publish-product</goal>
                        </goals>
                        <configuration>
                            <productConfigurationFile>${basedir}/carbon.product</productConfigurationFile>
                            <executable>
                                ${basedir}/target/org.eclipse.equinox.executable_3.5.0.v20110530-7P7NFUFFLWUl76mart
                            </executable>
                            <metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
                            <artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
                        </configuration>
                    </execution>
                    <execution>
                        <id>materialize-broker-default-profile</id>
                        <phase>package</phase>
                        <goals>
                            <goal>materialize-product</goal>
                        </goals>
                        <configuration>
                            <productConfigurationFile>${basedir}/carbon.product
                            </productConfigurationFile>
                            <metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
                            <artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
                            <targetPath>
                                file:${basedir}/target/wso2carbon-core-${carbon.kernel.version}/wso2/components
                            </targetPath>
                            <profile>broker-default</profile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>3-p2-profile-generation</id>
                        <phase>package</phase>
                        <goals>
                            <goal>p2-profile-gen</goal>
                        </goals>
                        <configuration>
                            <profile>broker-default</profile>
                            <metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
                            <artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
                            <destination>
                                ${basedir}/target/wso2carbon-core-${carbon.kernel.version}/wso2/components
                            </destination>
                            <deleteOldProfileFiles>true</deleteOldProfileFiles>
                            <features>
                                <feature>
                                    <id>org.wso2.carbon.logging.mgt.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.databridge.datapublisher.feature.group</id>
                                    <version>${carbon.analytics.common.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.system.statistics.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.soaptracer.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.security.mgt.feature.group</id>
                                    <version>${carbon.identity.framework.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.message.flows.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>

                                <feature>
                                    <id>org.wso2.carbon.tryit.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.registry.contentsearch.feature.group</id>
                                    <version>${carbon.registry.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.registry.core.feature.group</id>
                                    <version>${carbon.registry.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.registry.resource.properties.feature.group
                                    </id>
                                    <version>${carbon.registry.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.wsdl.tools.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.um.ws.service.feature.group</id>
                                    <version>${carbon.um.ws.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.messaging.andes.feature.group</id>
                                    <version>${carbon.messaging.version}</version>
                                </feature>
                                <!--Cloud service deployment feature -->
                                <feature>
                                    <id>org.wso2.carbon.tenant.deployment.feature.group</id>
                                    <version>${carbon.multitenancy.version}</version>
                                </feature>
                                <!-- multitenancy feature groups -->
                                <feature>
                                    <id>org.wso2.carbon.tenant.common.server.feature.group</id>
                                    <version>${carbon.multitenancy.version}</version>
                                </feature>
                                <feature>
                                    <id>
                                        org.wso2.carbon.identity.authenticator.saml2.sso.server.feature.group
                                    </id>
                                    <version>${identity.carbon.auth.saml2.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.tenant.usage.agent.feature.group</id>
                                    <version>${carbon.multitenancy.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.tenant.throttling.agent.feature.group</id>
                                    <version>${carbon.multitenancy.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.user.mgt.feature.group</id>
                                    <version>${carbon.identity.framework.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.identity.core.feature.group</id>
                                    <version>${carbon.identity.framework.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.messaging.metrics.feature.group</id>
                                    <version>${carbon.messaging.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.metrics.feature.group</id>
                                    <version>${carbon.metrics.version}</version>
                                </feature>
                                <!--cipher tool-->
                                <feature>
                                    <id>org.wso2.ciphertool.feature.group</id>
                                    <version>${cipher.tool.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.analytics.shared.data.agents.log4j.feature.group</id>
                                    <version>${analytics.shared.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature.group</id>
                                    <version>${carbon.device.mgt.plugin.version}</version>
                                </feature>

                            </features>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <id>creating-required-resources</id>
                        <phase>test</phase>
                        <configuration>
                            <tasks>
                                <mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/wso2/conf" />
                                <copy todir="target/wso2carbon-core-${carbon.kernel.version}/wso2/conf">
                                    <fileset dir="target/wso2carbon-core-${carbon.kernel.version}/repository/conf" />
                                </copy>
                                <delete dir="target/wso2carbon-core-${carbon.kernel.version}/repository/conf" includeemptydirs="true" />
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <phase>package</phase>
                        <configuration>
                            <tasks>
                                <replace token="false" value="true" dir="target/wso2carbon-core-${carbon.kernel.version}/wso2/components">
                                    <include name="**/bundles.info" />
                                </replace>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
package convenientadditions.compat.jei.transmutationTome;

import convenientadditions.api.util.Helper;
import convenientadditions.ModConstants;
import convenientadditions.compat.jei.ConvAddJEIPlugin;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;

public class RecipeCategoryTransmutationTome extends BlankRecipeCategory<RecipeWrapperTransmutationTome> {
    private static final ResourceLocation jeiTomeGuiTextures = new ResourceLocation(ModConstants.Mod.MODID + ":textures/gui/jei/transmutationtome.png");
    private static final IDrawable background = ConvAddJEIPlugin.jeiHelper.getGuiHelper().createDrawable(jeiTomeGuiTextures, 0, 0, 115, 56);

    public static final RecipeCategoryTransmutationTome INSTANCE=new RecipeCategoryTransmutationTome();

    @Override
    public String getUid() {
        return ModConstants.Mod.MODID + ":" + ModConstants.Compat.JEI.transmutationTomeCategory;
    }

    @Override
    public String getTitle() {
        return Helper.localize("jei." + ModConstants.Mod.MODID + ":" + ModConstants.Compat.JEI.transmutationTomeCategory + ".name");
    }

    @Override
    public IDrawable getBackground() {
        return background;
    }

    @Override
    public void setRecipe(IRecipeLayout recipeLayout, RecipeWrapperTransmutationTome recipeWrapper, IIngredients ingredients) {
        recipeLayout.getItemStacks().init(0, true, 7, 18);
        recipeLayout.getItemStacks().init(1, true, 31, 18);
        recipeLayout.getItemStacks().init(2, false, 77, 18);
        recipeLayout.getItemStacks().set(0, ingredients.getInputs(ItemStack.class).get(0));
        recipeLayout.getItemStacks().set(1, ingredients.getInputs(ItemStack.class).get(1));
        recipeLayout.getItemStacks().set(2, ingredients.getOutputs(ItemStack.class).get(0));
    }

}


text:
<mvc:View
	height="100%"
	controllerName="sap.m.sample.MultiComboBoxGrouping.controller.MultiComboBoxGrouping"
	xmlns:l="sap.ui.layout"
	xmlns:core="sap.ui.core"
	xmlns:mvc="sap.ui.core.mvc"
	xmlns="sap.m">
	<l:VerticalLayout
		class="sapUiContentPadding"
		width="100%">
		<MultiComboBox
			width="500px"
			items="{
				path: '/ProductCollection',
				sorter: {
					path: 'SupplierName',
					descending: false,
					group: true
				},
				groupHeaderFactory: '.getGroupHeader'
			}">
			<core:Item key="{ProductId}" text="{Name}" />
		</MultiComboBox>
	</l:VerticalLayout>
</mvc:View>


text:
require("trouble").setup {
  icons = false,
  use_diagnostic_signs = true,
}


text:
using Mikepenz.Iconics.Typeface;

namespace AndroidIconicsSample
{
  using System;
  using Android.App;
  using Android.Runtime;
  using AndroidIconicsSample.Typeface;
	using Mikepenz.Typeface;
	using Mikepenz.Iconics;

  [Application(Theme = "@style/AppTheme")]
  public class CustomApplication : Application
  {
    public CustomApplication(IntPtr handle, JniHandleOwnership ownerShip)
      : base(handle, ownerShip)
    {
      Iconics.RegisterFont(new Meteoconcs());
      Iconics.RegisterFont(new Octicons());
      Iconics.RegisterFont(new CommunityMaterial());
      Iconics.RegisterFont(new CustomFont());
			Iconics.RegisterFont(new FontAwesome());
			Iconics.RegisterFont(new GoogleMaterial());

			//Generic font creation process
			GenericFont gf2 = new GenericFont("GenericFont", "SampleGenericFont", "gmf", "fonts/materialdrawerfont.ttf");
			gf2.RegisterIcon("person", '\ue800');
			gf2.RegisterIcon("up", '\ue801');
			gf2.RegisterIcon("down", '\ue802');
			Iconics.RegisterFont(gf2);
    }

    public override void OnCreate()
    {
      base.OnCreate();
    }
  }
}


text:
scope = "System"
description = """
  This role grants a user basic object creation and editing permission.
  """
permissions = {
    "read": [
        "Audit",
        "Categorization",
        "Category",
        "Comment",
        "ControlCategory",
        "ControlAssertion",
        "Control",
        "Assessment",
        "CustomAttributeDefinition",
        "CustomAttributeValue",
        "Issue",
        "DataAsset",
        "AccessGroup",
        "Directive",
        "Contract",
        "Policy",
        "Regulation",
        "Standard",
        "Document",
        "Facility",
        "Help",
        "Market",
        "Objective",
        "ObjectDocument",
        "ObjectOwner",
        "ObjectPerson",
        "Option",
        "OrgGroup",
        "Vendor",
        "PopulationSample",
        "Product",
        "Project",
        "Relationship",
        "Section",
        "Clause",
        "SystemOrProcess",
        "System",
        "Process",
        "Person",
        "Program",
        "Role",
        "Request",
        "Context",
        {
            "type": "BackgroundTask",
            "terms": {
                "property_name": "modified_by",
                "value": "$current_user"
            },
            "condition": "is"
        },
    ],
    "create": [
        "Audit",
        "Workflow"
        "Categorization",
        "Category",
        "Comment",
        "ControlCategory",
        "ControlAssertion",
        "Control",
        "Assessment",
        "Issue",
        "DataAsset",
        "AccessGroup",
        "Directive",
        "Contract",
        "Policy",
        "Regulation",
        "Standard",
        "Document",
        "Facility",
        "Help",
        "Market",
        "Objective",
        "ObjectDocument",
        "ObjectPerson",
        "Option",
        "OrgGroup",
        "Vendor",
        "PopulationSample",
        "Product",
        "Project",
        "Relationship",
        "Section",
        "Clause",
        "SystemOrProcess",
        "System",
        "Process",
        "ObjectOwner",
        "Person",
        "Program",
        "Role",
        "UserRole",
        "Request",
        "Context",
        {
            "type": "BackgroundTask",
            "terms": {
                "property_name": "modified_by",
                "value": "$current_user"
            },
            "condition": "is"
        },
    ],
    "view_object_page": [
        "__GGRC_ALL__"
    ],
    "update": [
        "Audit",
        "Workflow",
        "Categorization",
        "Category",
        "Comment",
        "ControlCategory",
        "ControlAssertion",
        "Control",
        "Assessment",
        "Issue",
        "DataAsset",
        "AccessGroup",
        "Directive",
        "Contract",
        "Policy",
        "Regulation",
        "Standard",
        "Document",
        "Facility",
        "Help",
        "Market",
        "Objective",
        "ObjectDocument",
        "ObjectPerson",
        "Person",
        "Option",
        "OrgGroup",
        "Vendor",
        "PopulationSample",
        "Product",
        "Project",
        "Relationship",
        "Section",
        "Clause",
        "SystemOrProcess",
        "System",
        "Process",
        "ObjectOwner",
        "Program",
        "Role",
        "UserRole",
        "Request",
        "Context",
        {
            "type": "BackgroundTask",
            "terms": {
                "property_name": "modified_by",
                "value": "$current_user"
            },
            "condition": "is"
        },
    ],
    "delete": [
        "Audit",
        "Workflow"
        "Categorization",
        "Category",
        "Comment",
        "ControlCategory",
        "ControlAssertion",
        "Control",
        "Assessment",
        "Issue",
        "DataAsset",
        "AccessGroup",
        "Directive",
        "Contract",
        "Policy",
        "Regulation",
        "Standard",
        "Document",
        "Facility",
        "Help",
        "Market",
        "Objective",
        "ObjectDocument",
        "ObjectPerson",
        "Option",
        "OrgGroup",
        "Vendor",
        "PopulationSample",
        "Product",
        "Project",
        "Relationship",
        "Section",
        "Clause",
        "SystemOrProcess",
        "System",
        "Process",
        "ObjectOwner",
        "Program",
        "Role",
        "UserRole",
        "Request",
        "Context",
        {
            "type": "BackgroundTask",
            "terms": {
                "property_name": "modified_by",
                "value": "$current_user"
            },
            "condition": "is"
        },
    ]
}


text:
import { IDispatcher, Service } from "../core";
import { BaseActionCreator } from "../core/action-creator";
import { ModalActionCreator } from "../modal/modal.actions";
import { Role } from "./role.model";

@Service({
	serviceName: "roleActionCreator",
    viewProviders: ["$location", "dispatcher", "roleService", "guid", "modalActionCreator"]
})
export class RoleActionCreator extends BaseActionCreator {
    constructor($location: angular.ILocationService, dispatcher: IDispatcher, roleService, guid, private modalActionCreator: ModalActionCreator) {
        super($location,roleService,dispatcher,guid,AddOrUpdateRoleAction,AllRolesAction,RemoveRoleAction,SetCurrentRoleAction)
    }

	addOrUpdateSuccess = options => this.dispatcher.dispatch(new AddOrUpdateRoleSuccessAction(options.entity));

    currentRoleRemoved = () => this.dispatcher.dispatch(new CurrentRoleRemovedAction());

    openRolePickerModal = () => {
        var newId = this.guid();
        this.service.get()
            .then(results => {
                this.dispatcher.dispatch(new AllRolesAction(newId, results));
                this.modalActionCreator.open({ html: "<role-picker-modal></role-picker-modal>" });
            });
        return newId;
    }

    selectRoles = (entities: Array<Role>) => this.dispatcher.dispatch(new SelectRolesAction(entities));
}

export class AddOrUpdateRoleAction { constructor(public id, public entity) { } }

export class AllRolesAction { constructor(public id, public entities) { } }

export class RemoveRoleAction { constructor(public id, public entity) { } }

export class RolesFilterAction { constructor(public id, public term) { } }

export class SetCurrentRoleAction { constructor(public entity) { } }

export class AddOrUpdateRoleSuccessAction { constructor(public entity) { } }

export class CurrentRoleRemovedAction { constructor() { } }

export class SelectRolesAction { constructor(public entities: Array<Role>) { } }