Package org.openrdf.model

Examples of org.openrdf.model.Model


      context = vf.createBNode();
    }

    con.add(context, RDF.TYPE, REPOSITORY_CONTEXT);

    Model model = new LinkedHashModel();
    config.export(model);
    con.add(model, context);

    con.commit();
  }
View Full Code Here


  }

  public Set<String> getIDs()
    throws StoreConfigException
  {
    Model model = getSystemModel();
    Set<String> ids = new HashSet<String>();
    for (Value obj : model.filter(null, REPOSITORYID, null).objects()) {
      ids.add(obj.stringValue());
    }
    return ids;
  }
View Full Code Here

  }

  public Model getConfig(String repositoryID)
    throws StoreConfigException
  {
    Model model = getSystemModel();
    Literal id = vf.createLiteral(repositoryID);
    for (Statement idStatement : model.filter(null, REPOSITORYID, id)) {
      Resource context = idStatement.getContext();

      if (context == null) {
        throw new StoreConfigException("No configuration context for repository " + repositoryID);
      }

      return model.filter(null, null, null, context);
    }
    return null;
  }
View Full Code Here

  @Override
  public Model getRepositoryConfig(String repositoryID)
    throws StoreConfigException
  {
    Model result = delegate.getRepositoryConfig(repositoryID);

    if (result != null) {
      if (!isCorrectType(result)) {
        RepositoryConfig config = parse(result);
        logger.debug(
View Full Code Here

  {
    for (Value value : config.filter(null, REPOSITORYID, null).objects()) {
      removeConfig(value.stringValue());
    }
   
    Model model = new LinkedHashModel();
    Resource context = vf.createBNode(id);
    model.add(context, RDF.TYPE, REPOSITORY_CONTEXT);
    model.add(context, REPOSITORYID, new LiteralImpl(id), context);
    for (Statement st : config) {
      model.add(st.getSubject(), st.getPredicate(), st.getObject(), context);
    }

    addSystemModel(model);
  }
View Full Code Here

  public void updateConfig(String id, Model config)
    throws StoreConfigException
  {

    Model model = new LinkedHashModel();
    Resource context = vf.createBNode(id);
    model.add(context, RDF.TYPE, REPOSITORY_CONTEXT);
    model.add(context, REPOSITORYID, new LiteralImpl(id), context);
    model.filter(null, null, null, context).addAll(config);

    addSystemModel(model);
  }
View Full Code Here

    throws StoreConfigException
  {
    logger.debug("Removing repository configuration for {}.", repositoryID);
    boolean isRemoved = false;

    Model model = getSystemModel();

    // clear existing context
    Literal id = vf.createLiteral(repositoryID);
    for (Resource ctx : model.filter(null, REPOSITORYID, id).contexts()) {
      clearSystemModel(ctx);
      isRemoved = true;
    }

    return isRemoved;
View Full Code Here

  }

  public ConfigTemplate getTemplate(String key)
    throws StoreConfigException
  {
    Model statements = client.templates().get(key);
    if (statements == null) {
      return null;
    }
    return new ConfigTemplate(statements, client.schemas().get());
  }
View Full Code Here

  {
    try {
      RDFFormat format = Rio.getParserFormatForFileName(file.getName());
      RDFParser parser = Rio.createParser(format);

      Model model = new LinkedHashModel();
      parser.setRDFHandler(new StatementCollector(model));

      InputStream stream = new FileInputStream(file);
      try {
        parser.parse(stream, file.toURI().toString());
View Full Code Here

    }
    implConfig.validate();
  }

  public Model export() {
    Model model = new LinkedHashModel();
    export(model);
    return model;
  }
View Full Code Here

TOP

Related Classes of org.openrdf.model.Model

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.