Package org.openrdf.model

Examples of org.openrdf.model.Model.filter()


  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);
      }
View Full Code Here

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

      return model.filter(null, null, null, context);
    }
    return null;
  }

  public void addConfig(String id, Model config)
View Full Code Here

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

  public boolean removeConfig(String repositoryID)
View Full Code Here

    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

        Yard yard = getYard();
        Representation rep = yard.getRepresentation(subject.stringValue());
        Assert.assertTrue(rep instanceof RdfRepresentation);
        Model model = ((RdfRepresentation)rep).getModel();
        //Assert for the indirect statements to be present in the model
        Assert.assertFalse(model.filter(null, property2, null).isEmpty());
        Assert.assertFalse(model.filter(null, loop1, null).isEmpty());
        Assert.assertFalse(model.filter(null, loop2, null).isEmpty());
    }
   
    /**
 
View Full Code Here

        Representation rep = yard.getRepresentation(subject.stringValue());
        Assert.assertTrue(rep instanceof RdfRepresentation);
        Model model = ((RdfRepresentation)rep).getModel();
        //Assert for the indirect statements to be present in the model
        Assert.assertFalse(model.filter(null, property2, null).isEmpty());
        Assert.assertFalse(model.filter(null, loop1, null).isEmpty());
        Assert.assertFalse(model.filter(null, loop2, null).isEmpty());
    }
   
    /**
     * This Method removes all Representations create via {@link #create()} or
View Full Code Here

        Assert.assertTrue(rep instanceof RdfRepresentation);
        Model model = ((RdfRepresentation)rep).getModel();
        //Assert for the indirect statements to be present in the model
        Assert.assertFalse(model.filter(null, property2, null).isEmpty());
        Assert.assertFalse(model.filter(null, loop1, null).isEmpty());
        Assert.assertFalse(model.filter(null, loop2, null).isEmpty());
    }
   
    /**
     * This Method removes all Representations create via {@link #create()} or
     * {@link #create(String, boolean)} from the tested {@link Yard}.
View Full Code Here

            // convert Sesame Model into a map to Metadata objects
            Map<String,Metadata> result = new HashMap<String, Metadata>();
           
            for(Resource subject : model.subjects()) {
                Metadata m = new Metadata(subject.stringValue());
                for(org.openrdf.model.URI property : model.filter(subject, null, null).predicates()) {
                    Set<RDFNode> propValue = new HashSet<RDFNode>();
                    for(Value value : model.filter(subject, property, null).objects()) {
                        propValue.add(parseRDFJSONNode(value));
                    }
                    m.put(property.stringValue(),propValue);
View Full Code Here

           
            for(Resource subject : model.subjects()) {
                Metadata m = new Metadata(subject.stringValue());
                for(org.openrdf.model.URI property : model.filter(subject, null, null).predicates()) {
                    Set<RDFNode> propValue = new HashSet<RDFNode>();
                    for(Value value : model.filter(subject, property, null).objects()) {
                        propValue.add(parseRDFJSONNode(value));
                    }
                    m.put(property.stringValue(),propValue);
                }
                result.put(subject.stringValue(),m);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.