Package org.openrdf.model

Examples of org.openrdf.model.Resource


      this.graph = new URIImpl(graph);
    }

    @Override
    public void handleStatement(Statement st) {
      Resource s = st.getSubject();
      URI p = st.getPredicate();
      Value o = st.getObject();
      super.handleStatement(new StatementImpl(s, p, o, graph));
    }
View Full Code Here


    Cursor<Statement> stIter;
    stIter = new ConvertingCursor<BindingSet, Statement>(bindingsIter) {

      @Override
      protected Statement convert(BindingSet bindingSet) {
        Resource subject = (Resource)bindingSet.getValue("subject");
        URI predicate = (URI)bindingSet.getValue("predicate");
        Value object = bindingSet.getValue("object");
        Resource context = (Resource)bindingSet.getValue("context");

        if (context == null) {
          return vf.createStatement(subject, predicate, object);
        }
        else {
View Full Code Here

  {
    ValueFactory vf = con.getValueFactory();

    con.begin();

    Resource context = getContext(con, id);

    if (context != null) {
      con.clear(context);
    }
    else {
View Full Code Here

  }

  private Resource getContext(RepositoryConnection con, String repositoryID)
    throws StoreException, StoreConfigException
  {
    Resource context = null;

    Statement idStatement = getIDStatement(con, repositoryID);
    if (idStatement != null) {
      context = idStatement.getContext();
    }
View Full Code Here

    this.removeContexts = removeContexts;
  }

  @Override
  public Resource export(Model model) {
    Resource repImplNode = super.export(model);

    ValueFactory vf = ValueFactoryImpl.getInstance();

    if (includeInferred != null) {
      Literal bool = vf.createLiteral(includeInferred);
View Full Code Here

    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);
      }
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);
    }
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

    conVar = sp.getContextVar();
  }

  @Override
  protected boolean accept(Statement st) {
    Resource subj = st.getSubject();
    URI pred = st.getPredicate();
    Value obj = st.getObject();
    Resource context = st.getContext();

    if (subjVar != null) {
      if (subjVar.equals(predVar) && !subj.equals(pred)) {
        return false;
      }
View Full Code Here

  public Model createConfig(List<ConfigProperty> properties) {
    int idx = 0;
    Model model = new LinkedHashModel();
    model.getNamespaces().putAll(statements.getNamespaces());
    for (Statement st : statements) {
      Resource subj = st.getSubject();
      URI pred = st.getPredicate();
      if (schema.contains(pred, null, null) && properties != null) {
        if (!properties.get(idx).getPredicate().equals(pred)) {
          throw new IllegalArgumentException("Invalid properties");
        }
View Full Code Here

TOP

Related Classes of org.openrdf.model.Resource

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.