Package org.xmedia.metak.eval

Examples of org.xmedia.metak.eval.SesameSparqlEvaluator


   public Repository getDataRepository(){
     return dataRepository;
   }
           
  public Map<Value, ComplexProvenance> metaEvaluateQuery(String queryString) throws RepositoryException{
    SesameSparqlEvaluator eval = new SesameSparqlEvaluator(dataRepository);
   
    if (this.nsr == null) {
      RepositoryResult<Namespace> nsi = dataRepository.getConnection().getNamespaces();
      Namespace ns;
      this.nsr = new SPARQLNSResolver();
      while (nsi.hasNext()){
        ns = nsi.next();
        this.nsr.addPrefixBinding(ns.getPrefix(), ns.getName());
      }
    }
   
    Hashtable prologPrefixTable = new Hashtable();   
    if (queryString.contains(_PREFIX)){
      int i = queryString.indexOf(_SELECT);
      if (i != -1){
        parsePrologPrefixDeclarations(queryString.substring(0, i), prologPrefixTable);       
      }
    }
    Hashtable defaultPrefixTable = nsr.getPrefixTable();
    Iterator iter = defaultPrefixTable.keySet().iterator();
    while (iter.hasNext()) {
      String prefix =  (String)iter.next();
      if (!prologPrefixTable.containsKey(prefix)){
        queryString = "PREFIX " + prefix + ": <" + (String)defaultPrefixTable.get(prefix) + ">" + NL + queryString;       
      }
    }
   
    Map<Set<Value>, ComplexProvenance> metadata = eval.evaluate(queryString);
       
    Map<Value, ComplexProvenance> provenance = new HashMap<Value, ComplexProvenance>();
    java.util.Iterator<Value> it;
    for (Set<Value> values: metadata.keySet()){
      it = values.iterator();
View Full Code Here

TOP

Related Classes of org.xmedia.metak.eval.SesameSparqlEvaluator

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.