Package letweb.semanticum.tsd

Examples of letweb.semanticum.tsd.LinkType


        jcas = aCAS.getJCas();
      } catch (CASException e) {
        throw new CollectionException(e);
      }
     
      LinkType lt = new LinkType(jcas);
     
      //lt.setVideoUrl(links.get(0));
      lt.setVideoUrl(connDb.getVideoUrl(idx));
     
      String [] temp = connDb.getLinks(idx);
      //Inizializzazione dell'array di stringhe
      StringArray ArrayVideoUriStringArray = new StringArray(jcas, temp.length);
      lt.setArrayVideoUri(ArrayVideoUriStringArray);
      //Riempimento dell'array di stringhe
      int i;
      for(i = 0; i<temp.length; i++)
        lt.setArrayVideoUri(i,temp[i]);
      lt.setSourceType(connDb.getSourceType(idx));
     
      temp = connDb.getAuthors(idx);
      StringArray authorsStringArray = new StringArray(jcas, temp.length);
      lt.setAuthors(authorsStringArray);
      for(i = 0; i<temp.length; i++)
        lt.setAuthors(i,temp[i]);
     
      lt.setDate(connDb.getDate(idx));
      lt.setMainTopic(connDb.getMainTopic(idx));
      lt.setDescription(connDb.getDescription(idx));
     
      temp = connDb.getKeywords(idx);
      StringArray keywordsStringArray = new StringArray(jcas,temp.length);
      lt.setKeywords(keywordsStringArray);
      for(i = 0; i<temp.length; i++)
        lt.setKeywords(i,temp[i]);
      lt.setId(connDb.getId().get(idx++));
      lt.addToIndexes();
     
  }
View Full Code Here


   
    Audio audio = new Audio(aJCas);
   
    // Prelievo dell'array di link dal aJCas
    Iterator linkIT = aJCas.getAnnotationIndex(LinkType.type).iterator();
    LinkType link = (LinkType) linkIT.next();
    // LinkType uri=null;
    // StringArray tempPath=null;
    // int i=0;
    // FSIndex linkT = aJCas.getAnnotationIndex(LinkType.type);
   
    // Assegnazione dell'array di link alla variabile locale
    StringArray videoUri = link.getArrayVideoUri();
   
    //Log degli uri dei video
    int i;
    for(i = 0; i < videoUri.size(); i++)
      getContext().getLogger().log(Level.WARNING, videoUri.get(i));
   
    // Ciclo per il download dei singoli video
    // Thread download = null;
    // for(i=0; i<videoUri.size(); i++){
    // //Istanziazione dei thread
    // download = new Thread( new Runnable() {
    // public void run() {
    // try {
    // //Assegnazione all'iesimo elemento il path in cui è stato scaricato
    // il file audio
    // tempPath.set(i,
    // AudioVideoProcessing.audioDownloadEndExtraction(uri.getSourceType(),
    // videoUri.get(i)));
    // } catch (IOException e) {
    // getContext().getLogger().log(Level.WARNING, "Error: " + e.getMessage());
    // } catch (InterruptedException e) {
    // getContext().getLogger().log(Level.WARNING, "Error: " + e.getMessage());
    // }
    // }
    // });
    // //Partenza di ogni singola istanza
    // download.start();
    // }
    // //Attesa della fine dei thread
    // try {
    // download.join();
    // } catch (InterruptedException e) {
    // getContext().getLogger().log(Level.WARNING, "Error: " + e.getMessage());
    // }
   
    //Inizializzazione dell'insieme di threads
    ExecutorService es = Executors.newCachedThreadPool();
    ArrayList<Callable<String>> tasks = new ArrayList<Callable<String>>();
    List<Future<String>> results = new ArrayList<Future<String>>();
   
    StringArray path = new StringArray(aJCas, videoUri.size());
    // Assegnazione dell'array di competenza
    audio.setAudioPath(path);
   
    for (i = 0; i < videoUri.size(); i++)
      tasks.add(new ThreadCallDownload(videoUri.get(i),link.getSourceType(),tp));
   
    try {
      //Metodo che esegue tutti i threads e restituisce i risultati una volta
      //terminati tutti i trheads
      results = es.invokeAll(tasks);
View Full Code Here

TOP

Related Classes of letweb.semanticum.tsd.LinkType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.