private function _primaryStrategy()
 {
     /*
      * PREPARATION
      *
      * */
     if (!TheContainer::wasSet(LUD_SPARQLFILTER)) {
         $store = null;
         $tripleDiff = new TripleDiff($this->uri, $this->language, $this->producesFilterList, $store);
         TheContainer::set(LUD_SPARQLFILTER, $tripleDiff->createFilter($this->producesFilterList));
     }
     $this->odbc = ODBC::getDefaultConnection();
     $graphURI = $this->graphURI;
     $annotationGraphURI = $this->annotationGraphURI;
     $generateOWLAxiomAnnotations = $this->generateOWLAxiomAnnotations;
     /*
      * STRATEGIES FOR DELETION
      * */
     Timer::start('LiveUpdateDestination::_odbc_sparul_delete_total');
     $this->_odbc_clean_sparul_delete_subresources();
     $this->_odbc_sparul_delete_subject_not_static($graphURI, $this->subjectSPARULpattern, TheContainer::get(LUD_SPARQLFILTER));
     //$this->_odbc_sparul_delete_language($graphURI, $languageProperties );
     //$this->_odbc_sparul_delete_language_oneQuery($graphURI, $languageProperties );
     Timer::stop('LiveUpdateDestination::_odbc_sparul_delete_total');
     /*
      * STRATEGIES FOR INSERTION
      * will do nothing if Options::getOption('debug_turn_off_insert') is true
      * */
     $this->_odbc_ttlp_insert_triples($this->tripleFromExtractor);
     $this->log(INFO, 'no of queries, insert: ' . $this->counterInserts . ' delete: ' . $this->counterDelete . ' odbc_total: ' . $this->counterTotalODBCOperations);
     /*
             if(Options::getOption('writeSPARULtoFiles')){
                 $this->writeSPARULtoFiles($deleteSPARUL, $insertSPARUL);
             }
     */
 }
 public function diffItSimple()
 {
     Timer::start('TripleDiff::total');
     //language is filtered right here
     $store = new SPARQLToRDFTriple($this->uri, $this->language);
     $tripleDiff = new TripleDiff($this->uri, $this->language, $this->predicateFilterList, $this->objectFilterList, $this->predicateObjectFilterList, $store);
     $diff = $tripleDiff->diff($this->tripleFromExtractor);
     Timer::stop('TripleDiff::total');
     /*
      *      basically this: is the structured data available
             $diff['filteredoutExtractor'] = $filteredoutExtractor;
             $diff['filteredoutStore'] = $filteredoutStore;
             $diff['insert'] = $insert;
             $diff['delete'] = $delete;
             $diff['remainderStore'] = $remainderStore ;
     */
     //CONVERT to triples SPARUL patterns e.g. <s> <p> """o"""@en.
     $insertpatterns = array();
     $deletepatterns = array();
     $intersected = array();
     $specialobjects = array();
     foreach ($diff['insert'] as $itrip) {
         $insertpatterns[] = $itrip->toSPARULPattern($this->storespecific);
     }
     foreach ($diff['filteredoutExtractor'] as $itrip) {
         $insertpatterns[] = $itrip->toSPARULPattern($this->storespecific);
     }
     foreach ($diff['delete'] as $dtrip) {
         $deletepatterns[] = $dtrip->toSPARULPattern($this->storespecific);
     }
     foreach ($diff['filteredoutStore'] as $dtrip) {
         $deletepatterns[] = $dtrip->toSPARULPattern($this->storespecific);
         $specialobjects[] = $dtrip->getObject()->toSPARULPattern($this->storespecific);
     }
     if (!Options::getOption('debug_keep_remaining_triples_from_store')) {
         foreach ($diff['remainderStore'] as $dtrip) {
             $deletepatterns[] = $dtrip->toSPARULPattern($this->storespecific);
         }
     }
     $intersected = array_intersect($deletepatterns, $insertpatterns);
     $insertpatternstmp = array_diff($insertpatterns, $deletepatterns);
     $deletepatternstmp = array_diff($deletepatterns, $insertpatterns);
     $insertpatterns = $insertpatternstmp;
     $deletepatterns = $deletepatternstmp;
     /*
             print_r($intersected);
             print_r($deletepatterns);
             print_r($insertpatterns);
     */
     $graphURI = Options::getOption('graphURI');
     $deleteSPARUL = $this->deleteToSparul($graphURI, $deletepatterns, $specialobjects);
     $insertSPARUL = $this->insertToSparul($graphURI, $insertpatterns);
     $result = array();
     $result['del'] = $deleteSPARUL;
     $result['ins'] = $insertSPARUL;
     return $result;
 }
    private function _odbc_sparul_delete_language_oneQuery($graphURI, $languageProperties)
    {
        //***********************
        //LANGUAGE
        //***********************
        //delete all triples with the current subject
        //where the lang properties with string object
        //from other language version are given, which should stay
        Timer::start('LiveUpdateDestination::_odbc_sparul_delete_english_total');
        $union = array();
        foreach ($languageProperties as $one) {
            $u = new URI($one, false);
            $union[] = '?p = ' . $u->toSPARULPattern();
        }
        $filter = TripleDiff::assembleTerms($union, '||');
        //$filter ='';
        $sparul = 'DELETE FROM  <' . $graphURI . '>
{ ' . $this->subjectSPARULpattern . ' ?p  ?o }
FROM  <' . $graphURI . '>
WHERE {
    ' . $this->subjectSPARULpattern . '  ?p  ?o .
    FILTER ( ' . $filter . ' && (lang(?o) = \'en\')).
}';
        if ($this->_odbc_sparul_execute($sparul)) {
            $this->counterDelete += 1;
        }
        Timer::stop('LiveUpdateDestination::_odbc_sparul_delete_english_total');
        $this->log(DEBUG, 'deleted language');
        //TESTS>>>>>>>>>>>>
        if (Options::getOption('debug_run_tests')) {
            $this->log(INFO, 'no test for language currently');
        }
        //TESTS<<<<<<<<<<<
    }