Changeset 8921

Show
Ignore:
Timestamp:
10/04/08 22:29:28 (7 weeks ago)
Author:
leosauermann
Message:

pimoservice: pimo:hasFolder is now considered similar to pimo:hasReferencingOccurrence in the methods of findThingForOccurrence

Location:
trunk/java/org.semanticdesktop.nepomuk.comp.pimoservice/src/org/semanticdesktop/nepomuk/comp/pimoservice/client
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/java/org.semanticdesktop.nepomuk.comp.pimoservice/src/org/semanticdesktop/nepomuk/comp/pimoservice/client/ClientSession.java

    r8593 r8921  
    6262import org.semanticdesktop.services.vocabulary.NAO; 
    6363import org.semanticdesktop.services.vocabulary.NRL; 
     64import org.semanticdesktop.services.vocabulary.NepomukConstants; 
    6465import org.semanticdesktop.services.vocabulary.PIMO; 
    6566 
     
    19721973 
    19731974    /** 
    1974          * gets all things which have informationElement as occourrence or grounding occurrence 
     1975         * gets all things which have informationElement as occourrence or grounding occurrence (and as folder!) 
    19751976         * @return the URI of the resource, which has informationElement as occourence. 
    19761977         */ 
     
    25962597     */ 
    25972598    public boolean isEditingAllowed(URI context) throws NotFoundException { 
     2599        // well, the crappy inferencing sail model is always editable somehow ... this line keeps trouble out. 
     2600        if (NepomukConstants.INFERRED_GRAPH.equals(context)) 
     2601                return true; 
    25982602        // have I been asked before? 
    25992603        Boolean b = ontologyIsWriteable.get(context.toString()); 
  • trunk/java/org.semanticdesktop.nepomuk.comp.pimoservice/src/org/semanticdesktop/nepomuk/comp/pimoservice/client/impl/PimoQueryImpl.java

    r8908 r8921  
    570570     */ 
    571571    public URI findThingForOccurrence(URI informationElement) { 
    572         return findThingForOccurrence(informationElement, true, true, true, true); 
    573         /*ClosableIterator<? extends Statement> iterator = null; 
    574         Set<URI> result = new HashSet<URI>(); 
    575         boolean open = mainRepository.isOpen(); 
    576         if (!open) 
    577             mainRepository.open(); 
    578         iterator = mainRepository.findStatements(Variable.ANY,Variable.ANY, PIMO.occurrence, informationElement); 
    579         try { 
    580             while (iterator.hasNext()) { 
    581                 Node node = iterator.next().getSubject(); 
    582                 if (node instanceof URI) { 
    583                     result.add(node.asURI()); 
    584                 } else { 
    585                     log.finer(node+" is no instance of an URI"); 
    586                 } 
    587             } 
    588         } finally { 
    589             iterator.close(); 
    590         } 
    591         iterator = mainRepository.findStatements(Variable.ANY,Variable.ANY, PIMO.groundingOccurrence, informationElement); 
    592         try { 
    593             while (iterator.hasNext()) { 
    594                 Node node = iterator.next().getSubject(); 
    595                 if (node instanceof URI) { 
    596                     result.add(node.asURI()); 
    597                 } else { 
    598                     log.finer(node+" is no instance of an URI"); 
    599                 } 
    600             } 
    601         } finally { 
    602             iterator.close(); 
    603         } 
    604         // check if they are things 
    605         for (Iterator<URI> i = result.iterator(); i.hasNext();) { 
    606             URI u = i.next(); 
    607             if (!mainRepository.containsStatements(Variable.ANY, u, PIMO.isDefinedBy, pimoClient.getPimoUri())) { 
    608                 i.remove(); 
    609             } 
    610         } 
    611 //        if (!open) 
    612 //            mainRepository.close(); 
    613         if (result.size() > 1) log.severe("More then one thing: "+result.toString()+" found for the occurence "+informationElement); 
    614         if (result.size() == 0) return null; 
    615         return result.iterator().next();*/ 
     572        URI result = findThingForOccurrence(informationElement, true, true, true, true); 
     573        // the "folder" case is not handled by the other method, hence here. 
     574        if (result == null) { 
     575                ClosableIterator<Statement> it = mainRepository.findStatements(Variable.ANY, Variable.ANY, PIMO.hasFolder, informationElement); 
     576                if (it.hasNext()) 
     577                        result=it.next().getSubject().asURI(); 
     578                it.close(); 
     579        } 
     580        return result; 
    616581    } 
    617582