<commit_before>package controllers;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import play.mvc.*;
import play.mvc.Http.MultipartFormData;
import play.mvc.Http.MultipartFormData.FilePart;
import play.data.*;
import static play.data.Form.*;
import play.data.validation.Constraints.*;
import play.mvc.Controller;
import views.html.*;

import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.io.UnparsableOntologyException;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotation;
import org.semanticweb.owlapi.model.OWLAnnotationProperty;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.reasoner.InferenceType;
import org.semanticweb.owlapi.reasoner.Node;
import org.semanticweb.owlapi.reasoner.NodeSet;
import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration;
import org.semanticweb.owlapi.reasoner.SimpleConfiguration;
import org.semanticweb.owlapi.reasoner.TimedConsoleProgressMonitor;
import org.semanticweb.owlapi.vocab.OWLRDFVocabulary;
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf;
import org.semanticweb.owlapi.model.OWLObjectProperty;

import uk.ac.manchester.cs.factplusplus.owlapiv3.FaCTPlusPlusReasoner;
import uk.ac.manchester.cs.factplusplus.owlapiv3.FaCTPlusPlusReasonerFactory;
import uk.ac.manchester.cs.owl.owlapi.mansyntaxrenderer.ManchesterOWLSyntaxOWLObjectRendererImpl;


public class Application extends Controller {
    
	
    static ArrayList<String> model = new ArrayList<String>();
    static ArrayList<String> beeModel = new ArrayList<String>();	     
    static ArrayList<String> CharacterList = new ArrayList<String>();
    static ArrayList<String> BeesList = new ArrayList<String>();
    public static ArrayList<String> KeyDescriptionArraylist = new ArrayList<String>();
    
    static int charCount;
    static int beeCountnumber;
	
    public static ArrayList<String> List1Comments = new ArrayList<String>();
    public static ArrayList<String> CharacterArraylist = new ArrayList<String>();
	String Path;
	
    //Ontology variables declaration
    public static OWLOntologyManager manager;
	public static File BeeOntologyfile;
	public static OWLOntology BeeCharacteristics;
	public static OWLDataFactory factory1;
	public static ManchesterOWLSyntaxOWLObjectRendererImpl renderer;
	public static FaCTPlusPlusReasonerFactory fppRF;
	public static TimedConsoleProgressMonitor progressMonitor;
	public static OWLReasonerConfiguration config;
	public static OWLReasoner reasoner;
	
    
    /**
     * The Ontology form.
     */
    public static class Ontology {
        @Required public ArrayList<String> features;
        public ArrayList<String> selectedFeatures;
        public ArrayList<String> results;
        public ArrayList<Boolean> selected;
        
        public Ontology(ArrayList<String> features, 
        		ArrayList<String> selectedFeatures, 
        		ArrayList<String> results ){
        	this.features = features;
        	this.selectedFeatures = selectedFeatures;
        	this.results = results;
        }
    }
    
    // -- Actions
    
    
    public static Result home(){
    	return ok(index.render("woop"));
    }
  
    /**
     * Handles the file upload.
     * @throws OWLOntologyCreationException 
     * @throws InterruptedException 
     */
    public static Result uploadFile() throws OWLOntologyCreationException, InterruptedException {
    	
    	Form<Ontology> ontologyForm = form(Ontology.class);
    	
    	MultipartFormData body = request().body().asMultipartFormData();
    	  FilePart ontologyFile = body.getFile("ontology");
    	  if (ontologyFile != null) {
    	   String fileName = ontologyFile.getFilename();
    	   String contentType = ontologyFile.getContentType(); 
    	   // ontology.get
    	   File file = ontologyFile.getFile();
    	    
    	   try{ 
    		   loadOntology(file.getPath());
    	   }
    	   catch(UnparsableOntologyException ex){
    		   return ok(index.render("Not a valid Ontology File"));
    	   }
    	  
    	  //Initiate the reasoner to classify ontology
    	  if (BeeOntologyfile.exists())
    	  {
    		reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
    		
    		System.out.println("suppp");
    		loadBeeCharacteristics();	
    	  }
    	    
    	  Ontology ontology = new Ontology(KeyDescriptionArraylist, null, null);
    	  return ok(view.render(ontology.features));
    	    
    	  } else {
    	    flash("error", "Missing file");<commit_msg>Deleted extra bits not needed.<commit_after>package controllers;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import play.mvc.*;
import play.mvc.Http.MultipartFormData;
import play.mvc.Http.MultipartFormData.FilePart;
import play.data.*;
import static play.data.Form.*;
import play.data.validation.Constraints.*;
import play.mvc.Controller;
import views.html.*;

import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.io.UnparsableOntologyException;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAnnotation;
import org.semanticweb.owlapi.model.OWLAnnotationProperty;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.reasoner.InferenceType;
import org.semanticweb.owlapi.reasoner.Node;
import org.semanticweb.owlapi.reasoner.NodeSet;
import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration;
import org.semanticweb.owlapi.reasoner.SimpleConfiguration;
import org.semanticweb.owlapi.reasoner.TimedConsoleProgressMonitor;
import org.semanticweb.owlapi.vocab.OWLRDFVocabulary;
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf;
import org.semanticweb.owlapi.model.OWLObjectProperty;

import uk.ac.manchester.cs.factplusplus.owlapiv3.FaCTPlusPlusReasoner;
import uk.ac.manchester.cs.factplusplus.owlapiv3.FaCTPlusPlusReasonerFactory;
import uk.ac.manchester.cs.owl.owlapi.mansyntaxrenderer.ManchesterOWLSyntaxOWLObjectRendererImpl;


public class Application extends Controller {
    
	
    static ArrayList<String> model = new ArrayList<String>();
    static ArrayList<String> beeModel = new ArrayList<String>();	     
    static ArrayList<String> CharacterList = new ArrayList<String>();
    static ArrayList<String> BeesList = new ArrayList<String>();
    public static ArrayList<String> KeyDescriptionArraylist = new ArrayList<String>();
    
    static int charCount;
    static int beeCountnumber;
	
    public static ArrayList<String> List1Comments = new ArrayList<String>();
    public static ArrayList<String> CharacterArraylist = new ArrayList<String>();
	String Path;
	
    //Ontology variables declaration
    public static OWLOntologyManager manager;
	public static File BeeOntologyfile;
	public static OWLOntology BeeCharacteristics;
	public static OWLDataFactory factory1;
	public static ManchesterOWLSyntaxOWLObjectRendererImpl renderer;
	public static FaCTPlusPlusReasonerFactory fppRF;
	public static TimedConsoleProgressMonitor progressMonitor;
	public static OWLReasonerConfiguration config;
	public static OWLReasoner reasoner;
	
    
    /**
     * The Ontology form.
     */
    public static class Ontology {
        @Required public ArrayList<String> features;
        public ArrayList<String> selectedFeatures;
        public ArrayList<String> results;
        public ArrayList<Boolean> selected;
        
        public Ontology(ArrayList<String> features, 
        		ArrayList<String> selectedFeatures, 
        		ArrayList<String> results ){
        	this.features = features;
        	this.selectedFeatures = selectedFeatures;
        	this.results = results;
        }
    }
    
    // -- Actions
    
    
    public static Result home(){
    	return ok(index.render(""));
    }
  
    /**
     * Handles the file upload.
     * @throws OWLOntologyCreationException 
     * @throws InterruptedException 
     */
    public static Result uploadFile() throws OWLOntologyCreationException, InterruptedException {
    	
    	Form<Ontology> ontologyForm = form(Ontology.class);
    	
    	MultipartFormData body = request().body().asMultipartFormData();
    	  FilePart ontologyFile = body.getFile("ontology");
    	  if (ontologyFile != null) {
    	   String fileName = ontologyFile.getFilename();
    	   String contentType = ontologyFile.getContentType(); 
    	   // ontology.get
    	   File file = ontologyFile.getFile();
    	    
    	   try{ 
    		   loadOntology(file.getPath());
    	   }
    	   catch(UnparsableOntologyException ex){
    		   return ok(index.render("Not a valid Ontology File"));
    	   }
    	  
    	  //Initiate the reasoner to classify ontology
    	  if (BeeOntologyfile.exists())
    	  {
    		reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
    		
    		//System.out.println("suppp");
    		loadBeeCharacteristics();	
    	  }
    	    
    	  Ontology ontology = new Ontology(KeyDescriptionArraylist, null, null);
    	  return ok(view.render(ontology.features));
    	    
    	  } else {
    	    flash("error", "Missing file");
{'fraction_non_alphanumeric': 0.09010901090109011, 'fraction_numerical': 0.0008000800080008001, 'mean_word_length': 3.854368932038835, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7464379', 'n_tokens_mistral': 3080, 'n_tokens_neox': 2960, 'n_words': 569}