Package org.openrdf.sesame.repository.local

Examples of org.openrdf.sesame.repository.local.LocalRepository


  /**
   *
   * @param gst
   */
  private void createThesaurusRepository(Thesaurus gst) throws Exception {
    LocalRepository thesaurusRepository;
    try {
      RepositoryConfig repConfig = new RepositoryConfig(gst.getKey());

      SailConfig syncSail = new SailConfig("org.openrdf.sesame.sailimpl.sync.SyncRdfSchemaRepository");
      SailConfig memSail = new org.openrdf.sesame.sailimpl.memory.RdfSchemaRepositoryConfig(
View Full Code Here


        repConfig.addSail(syncSail);
        repConfig.addSail(memSail);
        repConfig.setWorldReadable(true);
        repConfig.setWorldWriteable(true);

        LocalRepository thesaurusRepository = Sesame.getService().createRepository(repConfig);
        setRepository(thesaurusRepository);
      return this;
  }
View Full Code Here

        repConfig.addSail(syncSail);
        repConfig.addSail(memSail);
        repConfig.setWorldReadable(true);
        repConfig.setWorldWriteable(true);

        LocalRepository thesaurusRepository = Sesame.getService().createRepository(repConfig);
        thesaurus.setRepository(thesaurusRepository);
  }
View Full Code Here

      reload();

      LocalService service = Sesame.getService();

      {
        LocalRepository contextRepository = service.createRepository(
            "contextRepository", false);
        contextGraph = contextRepository.getGraph();
      }

      defaultContext = graph.getValueFactory().createBNode();

      // Sail sail = repository.getSail();
View Full Code Here

   *
   * @see org.corrib.s3b.mbb.service.MBBService#execute()
   */
  @Override
  public LocalRepository execute(LocalRepository inGraph) {
    LocalRepository lr = RepositoryFactory.createTempRepository();
    String url = ConfigKeeper.getServiceUrl()+"/context/"+this.getParams().get(1);
    String call = this.getParams().get(2);

   
    Value[] aaction = SesameWrapper.performVectorQuery(Repository.MAIN_REPOSITORY.getLocalRepository(),
                               RDFQuery.RDFQ_GET_ACTION_BY_CALL, call, url);
   
    List<Integer> _usedPath = new ArrayList<Integer>();
   
    if(aaction != null && aaction.length > 0) {
      Value action = aaction[0];
     
      //1. load info about the action
      String squery = RDFQuery.RDFQ_GET_ACTION_IN_CONTEXT.toString(action);
     
      Graph g2 = SesameWrapper.performGraphQuery(Repository.MAIN_REPOSITORY.getLocalRepository(),
                             QueryLanguage.SERQL, squery);     
      try {
        lr.addGraph(g2);

        //2. compute the path
        this.computerPath(lr.getGraph(), action, _usedPath);

      } catch (IOException e) {
        Repository.logger.warning(e.toString());
      } catch (AccessDeniedException e) {
        Repository.logger.warning(e.toString());
View Full Code Here

public class DifferenceCombineService extends CombineService {


  @Override
  public LocalRepository execute(LocalRepository inGraph) {
    LocalRepository lr = RepositoryFactory.getServiceRepository(this.getUri());
   
    try {
      if(lr.getGraph().getStatements().hasNext())
        return lr;//it means that we already invoked this query
    } catch (AccessDeniedException e) {
      Repository.logger.warning(e.toString());
    }
   
    //otherwise we need to execute the query
    String service1Id = this.params.get(2);
    String service2Id = this.params.get(3);
   
    LocalRepository lr1 = ServiceById.getRepositoryByServiceId(service1Id);
    LocalRepository lr2 = ServiceById.getRepositoryByServiceId(service2Id);
   
    Value[] av1 = SesameWrapper.performVectorQuery(lr1, RDFQuery.RDFQ_LIST_RESOURCES);
    Value[] av2 = SesameWrapper.performVectorQuery(lr2, RDFQuery.RDFQ_LIST_RESOURCES);
   
    Set<Value> sAv = new HashSet<Value>();
View Full Code Here

    this.pnamespace = PredefinedNamespace.get();
  }

  @Override
  public LocalRepository execute(LocalRepository inGraph) {
    LocalRepository lr = RepositoryFactory.getServiceRepository(this.getUri());
   
   
    //otherwise we need to execute the query
   
    boolean isNegation = MBBService.NEGATION.equals(this.params.get(1));
    boolean isInverse = MBBService.INVERSE.equals(this.params.get(2));
    String sFullProperty = this.params.get(3);
    String sPropertyNS = this.params.get(4);
    String sPropertyName = this.params.get(5);
    boolean uriprop = (null == sPropertyNS || "".equals(sPropertyNS));
    String[] asFullProperty = null;


    if(uriprop) {
      if(null != sPropertyName && !"".equals(sPropertyName))
        sFullProperty = sPropertyName;
     
      sFullProperty = URLDecode.decode(sFullProperty); // -- sFullProperty can be a property name or a URL-encoded URI
      URI u;
      try {
        u = new URI(sFullProperty);
      } catch (URISyntaxException e) {
        u = null;
      }
     
      String prop;
     
      if(u == null || !u.isAbsolute()){
        asFullProperty = this.pproperty.getURI(sFullProperty); // if sFullProperty is a property name - get all URI
        prop = sFullProperty;
      } else {
        asFullProperty = new String[1];
        asFullProperty[0] = sFullProperty;
        prop = this.pproperty.getName(sFullProperty);
      }
     
      this.params.set(3, prop);
    }

    try {
      if(lr.getGraph().getStatements().hasNext())
        return lr;//it means that we already invoked this query
    } catch (AccessDeniedException e) {
      Repository.logger.warning(e.toString());
    }
   
   
    RDFQuery rdfquery;
//    String pparam;
    String restparam;
    String using;
   
    //this is the type of browse when you match values
    rdfquery  = (isInverse)?RDFQuery.RDFQ_BROWSE_LISTVALUES_PROPERTY_INVERSE:RDFQuery.RDFQ_BROWSE_LISTVALUES_PROPERTY;

   
    if(uriprop) {
      using = "";
//      pparam = "prop";//(isNegation)?"prop":"<"+sFullProperty+">";
      restparam = (isNegation)?"NOT (":"(";
      if(asFullProperty != null)
      for(String s : asFullProperty){
        restparam += "prop = <"+s+"> OR ";
      }
      if(restparam.length() > 4)
        restparam = restparam.substring(0, restparam.length()-4);
      restparam += ")";
//      restparam = (isNegation)?"NOT prop = <"+sFullProperty+">":"TRUE";
    }else {
//      String property = this.pproperty.getURI(sPropertyName);
//      pparam = "prop";//(sPropertyNS == null)?"<"+property+">":"prop";
      restparam = "TRUE";
      if(!"*".equals(sPropertyNS))
        restparam += ((!isNegation)?" AND (":" AND (NOT ")+"namespace(prop) = property:";
      //namespace(prop) = property: AND localName(prop) LIKE "*digitaltype*" //IGNORE CASE
      if(!"*".equals(sPropertyName) && !"*".equals(sPropertyNS))
        restparam += (!isNegation)?" AND ":" OR ";
      if(!"*".equals(sPropertyName))
        restparam += ((!isNegation)?"":"NOT")+" localName(prop)=\""+sPropertyName+"\"";
      if(!"*".equals(sPropertyNS))
        restparam += ") ";
 
      using = (!"*".equals(sPropertyNS))?" USING NAMESPACE mbb = <http://s3b.corrib.org/mbb#>"+RDFQuery.RDFQ_ADD_NAMESPACE.toString(this.pnamespace.getURI(sPropertyNS)):"";
    }
   
    String valueQueryPart = rdfquery.toString(/*pparam, */restparam);
         valueQueryPart += using;
    //no need for predefined properties
    Repository.logger.info(valueQueryPart);
    Value[] avUris = SesameWrapper.performVectorQuery(inGraph, QueryLanguage.SERQL, valueQueryPart);

    try {
      SesameWrapper.loadResources(avUris, Repository.MAIN_REPOSITORY.getLocalRepository(), lr.getGraph());
    } catch (AccessDeniedException e) {
      e.printStackTrace();
    }
    this.annotateResults(lr, avUris);

View Full Code Here

   *
   * @see org.corrib.s3b.mbb.service.MBBService#execute()
   */
  @Override
  public LocalRepository execute(LocalRepository inGraph) {
    LocalRepository lr = RepositoryFactory.getServiceRepository(this.getUri());
   
    //otherwise we need to execute the query
   
    boolean isNegation = MBBService.NEGATION.equals(this.params.get(1));
    boolean isInverse = MBBService.INVERSE.equals(this.params.get(2));
    String sPropertyURI = URLDecode.decode(this.params.get(3));
    String sValues = URLDecode.decode(this.params.get(4));

    String prop = this.pproperty.getName(sPropertyURI);
   
    this.params.set(3, (prop!=null)?prop:sPropertyURI);
    this.params.set(4, sValues);
   
    try {
      if(lr.getGraph().getStatements().hasNext())
        return lr;//it means that we already invoked this query
    } catch (AccessDeniedException e) {
      Repository.logger.warning(e.toString());
    }
   
    // --- non inverse scenario ---
    //we only need to filter values
    String props = "(%1$s)";
         props += (!isNegation)?" AND":" OR NOT";
         props += " prop=<"+sPropertyURI+">";
       
    //we need it only when namespace defined
    RDFQuery rdfquery = (isInverse)?RDFQuery.RDFQ_INVERS_FILTER:RDFQuery.RDFQ_FILTER;
    String queryPart = rdfquery.toString("prop",//just prop
                             props);//we only need to filter values
    String query = new ValueFilter(sValues).process(queryPart, this.isIgnoreCase());
        query += " USING NAMESPACE mbb = <http://s3b.corrib.org/mbb#>";

    Repository.logger.info("URIPropertyFilterService: "+query);
   
    Value[] results;
    try {
      results = SesameWrapper.performDisjunctiveQuery(inGraph, lr.getGraph(), query);
      this.annotateResults(lr, results);
    } catch (AccessDeniedException e) {
      e.printStackTrace();
    }
   
View Full Code Here

public class BindingCombineService extends CombineService {


  @Override
  public LocalRepository execute(LocalRepository inGraph) {
    LocalRepository lr = RepositoryFactory.getServiceRepository(this.getUri());
   
    try {
      if(lr.getGraph().getStatements().hasNext())
        return lr;//it means that we already invoked this query
    } catch (AccessDeniedException e) {
      Repository.logger.warning(e.toString());
    }
   
    //otherwise we need to execute the query
    String service1Id = this.params.get(2);
    String service2Id = this.params.get(3);
   
    LocalRepository lr1 = ServiceById.getRepositoryByServiceId(service1Id);
    LocalRepository lr2 = ServiceById.getRepositoryByServiceId(service2Id);

    Set<Value> sValues1 = new HashSet<Value>();
    Set<Value> sValues2 = new HashSet<Value>();
   
    sValues1.addAll(Arrays.asList(SesameWrapper.performVectorQuery(lr1, RDFQuery.RDFQ_LIST_RESOURCES)));
View Full Code Here

  public LocalRepository execute(LocalRepository inGraph) {

    String param = this.params.get(2);
    String format = this.params.get(3);

    LocalRepository local = RepositoryFactory.getServiceRepository(param);
   
    try {
      if (local != null && !local.getGraph().getStatements().hasNext()) {
        this.getGraph(param, format, local);
       
//      try {
//        this.annotateResults(local, local.getGraph().getValueFactory().createURI(param));
//      } catch (AccessDeniedException e) {
View Full Code Here

TOP

Related Classes of org.openrdf.sesame.repository.local.LocalRepository

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.