Package org.openrdf.model

Examples of org.openrdf.model.URIFactory


    throws Exception
  {
    MemoryStore store = new MemoryStore(dataDir);
    store.initialize();

    URIFactory factory = store.getURIFactory();
    URI foo = factory.createURI("http://www.foo.example/foo");
    URI bar = factory.createURI("http://www.foo.example/bar");

    SailConnection con = store.getConnection();
    con.addStatement(foo, RDF.TYPE, bar);

    TupleQueryModel query = QueryParserUtil.parseTupleQuery(QueryLanguage.SERQL,
        "SELECT X, P, Y FROM {X} P {Y}", null);

    Cursor<? extends BindingSet> iter = con.evaluate(query,
        EmptyBindingSet.getInstance(), false);

    BindingSet bindingSet = iter.next();

    assertEquals(bindingSet.getValue("X"), foo);
    assertEquals(bindingSet.getValue("P"), RDF.TYPE);
    assertEquals(bindingSet.getValue("Y"), bar);
    iter.close();
    con.close();

    store.shutDown();

    store = new MemoryStore(dataDir);
    store.initialize();

    factory = store.getURIFactory();
    foo = factory.createURI("http://www.foo.example/foo");
    bar = factory.createURI("http://www.foo.example/bar");

    con = store.getConnection();

    iter = con.evaluate(query, EmptyBindingSet.getInstance(), false);
View Full Code Here


    throws Exception
  {
    MemoryStore store = new MemoryStore(dataDir);
    store.initialize();

    URIFactory factory = store.getURIFactory();
    URI foo = factory.createURI("http://www.foo.example/foo");

    StringBuilder sb = new StringBuilder(66000);
    for (int i = 0; i < 66000; i++) {
      sb.append('a');
    }
View Full Code Here

  public HTTPRepositoryConnection(HTTPRepository repository, ConnectionClient client) {
    super(repository);
    this.repository = repository;
    this.client = client;

    URIFactory uf = repository.getURIFactory();
    LiteralFactory lf = repository.getLiteralFactory();
    HTTPBNodeFactory bf = new HTTPBNodeFactory(client.bnodes());
    this.vf = new ValueFactoryImpl(bf, uf, lf);

    this.creatorTrace = debugEnabled() ? new Throwable() : null;
View Full Code Here

  }

  private Object[] getArrayOf(Class<?> type, String localName)
    throws MalformedURLException
  {
    URIFactory uf = repository.getURIFactory();
    URI pred = uf.createURI(Protocol.METADATA_NAMESPACE, localName);
    if (type.isAssignableFrom(String.class)) {
      return getString(pred);
    }
    else if (type.isAssignableFrom(Boolean.TYPE)) {
      return getBoolean(pred);
View Full Code Here

    if (repository == null) {
      writeError("please open a repository first");
      return;
    }

    URIFactory valueFactory = repository.getURIFactory();

    Resource[] contexts = new Resource[tokens.length - 1];

    for (int i = 1; i < tokens.length; i++) {
      String contextID = tokens[i];

      if (contextID.equalsIgnoreCase("null")) {
        contexts[i - 1] = null;
      }
      else {
        try {
          contexts[i - 1] = valueFactory.createURI(contextID);
        }
        catch (IllegalArgumentException e) {
          writeError("illegal URI: " + contextID);
          printHelpClear();
          return;
View Full Code Here

  public FederationConnection(Federation federation, List<RepositoryConnection> members) {
    this.federation = federation;

    BNodeFactoryImpl bf = new BNodeFactoryImpl();
    URIFactory uf = federation.getURIFactory();
    LiteralFactory lf = federation.getLiteralFactory();
    vf = new ValueFactoryImpl(bf, uf, lf);

    this.members = new ArrayList<SignedConnection>(members.size());
    for (RepositoryConnection member : members) {
View Full Code Here

  }

  private void createEmployee(String id, String name, int empId)
    throws StoreException
  {
    URIFactory uf = repository.getURIFactory();
    LiteralFactory lf = repository.getLiteralFactory();
    String foafName = "http://xmlns.com/foaf/0.1/name";
    String exEmpId = "http://example.org/ns#empId";
    RepositoryConnection conn = repository.getConnection();
    conn.add(uf.createURI("http://example.org/ns#" + id), uf.createURI(foafName), lf.createLiteral(name));
    conn.add(uf.createURI("http://example.org/ns#" + id), uf.createURI(exEmpId), lf.createLiteral(empId));
    conn.close();
  }
View Full Code Here

      BeanInfo info = Introspector.getBeanInfo(RepositoryMetaData.class);
      PropertyDescriptor[] properties = info.getPropertyDescriptors();

      Repository repository = getRepository();
      RepositoryMetaData data = repository.getMetaData();
      URIFactory uf = repository.getURIFactory();
      LiteralFactory lf = repository.getLiteralFactory();

      URI subj = uf.createURI(getRequest().getResourceRef().toString(false, false));

      Model model = new LinkedHashModel();
      for (PropertyDescriptor p : properties) {
        Object o = p.getReadMethod().invoke(data);
        if (o instanceof Object[]) {
View Full Code Here

  protected VirtuosoRepositoryConnection(VirtuosoRepository repository, Connection connection) throws StoreException {
    this.quadStoreConnection = connection;
    this.repository = repository;
    this.useLazyAdd = repository.useLazyAdd;
    this.prefetchSize = repository.prefetchSize;
    URIFactory uf = repository.getURIFactory();
    LiteralFactory lf = repository.getLiteralFactory();
    this.vf = new ValueFactoryImpl(uf, lf);
    this.nilContext = getValueFactory().createURI(repository.defGraph);
    this.repository.initialize();
View Full Code Here

TOP

Related Classes of org.openrdf.model.URIFactory

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.