Package org.deri.grefine.reconcile.rdf.executors

Examples of org.deri.grefine.reconcile.rdf.executors.QueryExecutor


public class QueryEndpointFactory {

  public QueryEndpoint getLarqQueryEndpoint(Model model){
    SparqlQueryFactory queryFactory = new JenaTextSparqlQueryFactory();
    QueryExecutor queryExecutor = new DumpQueryExecutor(model);
    return new QueryEndpointImpl(queryFactory, queryExecutor);
  }
View Full Code Here


        ImmutableList.copyOf(searchPropertyUris), endpoint, serviceObj.getDouble("matchThreshold"));
  }

  private QueryEndpoint loadEndpointFromJSON(JSONObject endpointObj) throws JSONException{
    String type = endpointObj.getString("type");
    QueryExecutor executor = loadQueryExecutorFromJSON(endpointObj.getJSONObject("queryExecutor"));
    SparqlQueryFactory factory = loadQueryFactoryFromJSON(endpointObj.getJSONObject("queryFactory"));
    if(type.equals("plain")){
      return new PlainSparqlQueryEndpoint((PlainSparqlQueryFactory)factory, executor);
    }else{
      //default
View Full Code Here

      model.read(url);
    }else{
      model.read(url,format);
    }
   
    QueryExecutor queryExecutor;
    if(propUris.size()==1){
      queryExecutor = new DumpQueryExecutor(model, propUris.get(0));
    }else{
      queryExecutor = new DumpQueryExecutor(model);
    }
View Full Code Here

    graph = graph==null || graph.trim().isEmpty()?null:graph;
    QueryEndpoint queryEndpoint;
    if(type.equals("jena-text")){
      SparqlQueryFactory queryFactory = new JenaTextSparqlQueryFactory();
      QueryExecutor queryExecutor = new RemoteQueryExecutor(url, graph);
      queryEndpoint = new QueryEndpointImpl(queryFactory, queryExecutor);
    }else if(type.equals("virtuoso")){
      SparqlQueryFactory queryFactory = new VirtuosoSparqlQueryFactory();
      QueryExecutor queryExecutor = new VirtuosoRemoteQueryExecutor(url, graph);;
      queryEndpoint = new QueryEndpointImpl(queryFactory, queryExecutor);
    }else if(type.equals("bigowlim")){
      SparqlQueryFactory queryFactory = new BigOwlImSparqlQueryFactory();
      QueryExecutor queryExecutor = new RemoteQueryExecutor(url, graph);
      queryEndpoint = new QueryEndpointImpl(queryFactory, queryExecutor);
    }else{
      //plain
      PlainSparqlQueryFactory queryFactory = new PlainSparqlQueryFactory();
      QueryExecutor queryExecutor = new RemoteQueryExecutor(url, graph);
      queryEndpoint = new PlainSparqlQueryEndpoint(queryFactory, queryExecutor);
    }
    ReconciliationService service = new RdfReconciliationService(id, name, propUris, queryEndpoint, DEFAULT_MATCH_THRESHOLD);
    return service;
  }
View Full Code Here

      if(name.isEmpty() || propUris.size()==0){
        throw new RuntimeException("name and at least one label property ar needed");
      }
     
      SparqlQueryFactory queryFactory = new JenaTextSparqlQueryFactory();
      QueryExecutor queryExecutor;
      if(propUris.size()==1){
        queryExecutor = new DumpQueryExecutor(model,propUris.get(0));
      }else{
        queryExecutor = new DumpQueryExecutor(model);
      }
View Full Code Here

  }
 
  public boolean hasResult(Model model, String queryString, ImmutableList<String> searchPropertyUris, int limit) {
    //reconcile then get types for each element in the reconciliation result assure that order is preserved
    ReconciliationRequest request = new ReconciliationRequest(queryString, limit);
    QueryExecutor queryExecutor = new DumpQueryExecutor(model);
    List<ReconciliationCandidate> candidates = reconcileEntities(queryExecutor, request, searchPropertyUris, 2.0);
    return ! candidates.isEmpty();
  }
View Full Code Here

  }
 
  public LinkedHashMultimap<String, String> guessType(Model model, String queryString, ImmutableList<String> searchPropertyUris, int limit) {
    //reconcile then get types for each element in the reconciliation result assure that order is preserved
    ReconciliationRequest request = new ReconciliationRequest(queryString, limit);
    QueryExecutor queryExecutor = new DumpQueryExecutor(model);
    List<ReconciliationCandidate> candidates = reconcileEntities(queryExecutor, request, searchPropertyUris, 2.0);
    List<String> entities = new ArrayList<String>();
    for(ReconciliationCandidate candidate:candidates){
      entities.add(candidate.getId());
    }
    if(entities.isEmpty()){
      //return empty result
      return LinkedHashMultimap.create();
    }
    String sparql = this.queryFactory.getTypesOfEntitiesQuery(ImmutableList.copyOf(entities));
    ResultSet resultSet = queryExecutor.sparql(sparql);
    Multimap<String, String> typesMap = this.queryFactory.wrapTypesOfEntities(resultSet);
    //order
    LinkedHashMultimap<String, String> result = LinkedHashMultimap.create();
    for(String uri:entities){
      result.putAll(uri, typesMap.get(uri));
View Full Code Here

TOP

Related Classes of org.deri.grefine.reconcile.rdf.executors.QueryExecutor

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.