Package org.openrdf.model

Examples of org.openrdf.model.ValueFactory


    {
      Cursor<? extends BindingSet> bindingsIter = getDelegate().evaluate(query,
          EmptyBindingSet.getInstance(), true);

      try {
        ValueFactory vf = getValueFactory();

        BindingSet bindings;
        while ((bindings = bindingsIter.next()) != null) {

          Value subj = bindings.getValue("subject");
          Value pred = bindings.getValue("predicate");
          Value obj = bindings.getValue("object");

          if (subj instanceof Resource && pred instanceof URI && obj != null) {
            statements.add(vf.createStatement((Resource)subj, (URI)pred, obj));
          }
        }
      }
      finally {
        bindingsIter.close();
View Full Code Here


public class DurationTest extends TestCase {

  public void testYearMonth()
    throws Exception
  {
    ValueFactory vf = new ValueFactoryImpl();
    Literal lit = vf.createLiteral("P1Y", DURATION_YEARMONTH);
    Duration duration = lit.durationValue();
    assertEquals(lit, vf.createLiteral(duration));
  }
View Full Code Here

  }

  public void testDayTime()
    throws Exception
  {
    ValueFactory vf = new ValueFactoryImpl();
    Literal lit = vf.createLiteral("P1D", DURATION_DAYTIME);
    Duration duration = lit.durationValue();
    assertEquals(lit, vf.createLiteral(duration));
  }
View Full Code Here

  }

  public void testFullDuration()
    throws Exception
  {
    ValueFactory vf = new ValueFactoryImpl();
    Literal lit = vf.createLiteral("P1Y1M1D", DURATION);
    Duration duration = lit.durationValue();
    assertEquals(lit, vf.createLiteral(duration));
  }
View Full Code Here

  /*--------------*
   * Constructors *
   *--------------*/

  public HTTPRepository(String serverURL, String repositoryID) {
    ValueFactory vf = new ValueFactoryImpl(new BNodeFactoryImpl(), uf, lf);
    pool = new HTTPConnectionPool(serverURL, vf);
    client = new SesameClient(pool).repositories().slash(repositoryID);
    cache = new RepositoryCache(client);
  }
View Full Code Here

    client = new SesameClient(pool).repositories().slash(repositoryID);
    cache = new RepositoryCache(client);
  }

  public HTTPRepository(String repositoryURL) {
    ValueFactory vf = new ValueFactoryImpl(new BNodeFactoryImpl(), uf, lf);
    String serverURL = Protocol.getServerLocation(repositoryURL);
    if (serverURL != null) {
      pool = new HTTPConnectionPool(serverURL, vf).location(repositoryURL);
    }
    else {
View Full Code Here

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

    ValueFactory vf = ValueFactoryImpl.getInstance();

    if (jdbcDriver != null) {
      model.add(implNode, JDBC_DRIVER, vf.createLiteral(jdbcDriver));
    }
    if (url != null) {
      model.add(implNode, URL, vf.createLiteral(url));
    }
    if (user != null) {
      model.add(implNode, USER, vf.createLiteral(user));
    }
    if (password != null) {
      model.add(implNode, PASSWORD, vf.createLiteral(password));
    }
    model.add(implNode, MAX_TRIPLE_TABLES, vf.createLiteral(maxTripleTables));

    return implNode;
  }
View Full Code Here

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

    ValueFactory vf = ValueFactoryImpl.getInstance();

    for (RepositoryImplConfig member : members) {
      model.add(implNode, MEMBER, member.export(model));
    }

    for (String space : localPropertySpace) {
      model.add(implNode, LOCALPROPERTYSPACE, vf.createURI(space));
    }

    model.add(implNode, DISTINCT, vf.createLiteral(distinct));

    model.add(implNode, READ_ONLY, vf.createLiteral(readOnly));

    return implNode;
  }
View Full Code Here

        return "FilterOutPartialMatches";
      }
    };

    // Convert the BindingSet objects to actual RDF statements
    final ValueFactory vf = getConnection().getValueFactory();
    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 {
          return vf.createStatement(subject, predicate, object, context);
        }
      }

      @Override
      protected String getName() {
View Full Code Here

   * @throws StoreConfigException
   */
  private void updateRepositoryConfigs(RepositoryConnection con, String id, RepositoryConfig config)
    throws StoreException, StoreConfigException
  {
    ValueFactory vf = con.getValueFactory();

    con.begin();

    Resource context = getContext(con, id);

    if (context != null) {
      con.clear(context);
    }
    else {
      context = vf.createBNode();
    }

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

    Model model = new LinkedHashModel();
View Full Code Here

TOP

Related Classes of org.openrdf.model.ValueFactory

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.