Package org.openrdf.model

Examples of org.openrdf.model.URI


    logger.debug("evaluating query..");
    TupleResult testCases = testCaseQuery.evaluate();
    while (testCases.hasNext()) {
      BindingSet bindingSet = testCases.next();

      URI testURI = (URI)bindingSet.getValue("testURI");
      String testName = bindingSet.getValue("testName").toString();
      String resultFile = bindingSet.getValue("resultFile").toString();
      String queryFile = bindingSet.getValue("queryFile").toString();
      URI defaultGraphURI = (URI)bindingSet.getValue("defaultGraph");
      Value action = bindingSet.getValue("action");

      logger.debug("found test case : {}", testName);

      // Query named graphs
      namedGraphsQuery.setBinding("action", action);
      TupleResult namedGraphs = namedGraphsQuery.evaluate();

      DatasetImpl dataset = null;

      if (defaultGraphURI != null || namedGraphs.hasNext()) {
        dataset = new DatasetImpl();

        if (defaultGraphURI != null) {
          dataset.addDefaultGraph(defaultGraphURI);
        }

        while (namedGraphs.hasNext()) {
          BindingSet graphBindings = namedGraphs.next();
          URI namedGraphURI = (URI)graphBindings.getValue("graph");
          dataset.addNamedGraph(namedGraphURI);
        }
      }

      // Check for lax-cardinality conditions
View Full Code Here


  }

  private SqlExpr valueOf(Value value) {
    if (value instanceof Literal) {
      Literal lit = (Literal)value;
      URI dt = lit.getDatatype();
      if (dt != null && XMLDatatypeUtil.isNumericDatatype(dt)) {
        try {
          return new DoubleValue(lit.doubleValue());
        }
        catch (NumberFormatException e) {
View Full Code Here

    throw unsupported(arg);
  }

  private SqlExpr valueOf(Value value) {
    if (value instanceof Literal) {
      URI datatype = ((Literal)value).getDatatype();
      if (datatype != null) {
        return str(datatype.stringValue());
      }
    }
    return sqlNull();
  }
View Full Code Here

  }

  private SqlExpr valueOf(Value value) {
    if (value instanceof Literal) {
      Literal lit = (Literal)value;
      URI dt = lit.getDatatype();
      if (dt != null && XMLDatatypeUtil.isCalendarDatatype(dt)) {
        try {
          return new NumberValue(getCalendarValue(lit.calendarValue()));
        }
        catch (IllegalArgumentException e) {
View Full Code Here

  }

  public void testExpr()
    throws Exception
  {
    URI pattern = vf.createURI("http://example.org/ns#", "pattern");
    URI flags = vf.createURI("http://example.org/ns#", "flags");
    BNode bnode = vf.createBNode();
    conn.add(bnode, pattern, vf.createLiteral("@Work.example"));
    conn.add(bnode, flags, vf.createLiteral("i"));
    TupleQuery query = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryExpr);
    TupleResult result = query.evaluate();
View Full Code Here

  private void createUser(String id, String name, String email)
    throws StoreException
  {
    RepositoryConnection conn = repository.getConnection();
    URI subj = vf.createURI("http://example.org/ns#", id);
    URI foafName = vf.createURI("http://xmlns.com/foaf/0.1/", "name");
    URI foafMbox = vf.createURI("http://xmlns.com/foaf/0.1/", "mbox");
    conn.add(subj, foafName, vf.createLiteral(name));
    conn.add(subj, foafMbox, vf.createURI("mailto:", email));
    conn.close();
  }
View Full Code Here

    if (!writingStarted) {
      throw new RuntimeException("Document writing has not yet been started");
    }

    Resource subj = st.getSubject();
    URI pred = st.getPredicate();
    Value obj = st.getObject();

    try {
      // SUBJECT
      writeResource(subj);
View Full Code Here

    if (datatype.length() == 0) {
      datatype = null;
    }

    URI dtURI = null;
    if (datatype != null) {
      dtURI = createURI(datatype);
    }

    return super.createLiteral(label, lang, dtURI);
View Full Code Here

    public long getCardinality(StatementPattern sp)
      throws StoreException
    {
      await();
      Resource subj = (Resource)getConstantValue(sp.getSubjectVar());
      URI pred = (URI)getConstantValue(sp.getPredicateVar());
      Value obj = getConstantValue(sp.getObjectVar());
      Resource context = (Resource)getConstantValue(sp.getContextVar());
      List<Value> key = Arrays.asList(subj, pred, obj, context);
      return cardinalities.get(key).longValue();
    }
View Full Code Here

    }

    @Override
    public void meet(StatementPattern sp) {
      final Resource subj = (Resource)getConstantValue(sp.getSubjectVar());
      final URI pred = (URI)getConstantValue(sp.getPredicateVar());
      final Value obj = getConstantValue(sp.getObjectVar());
      final Resource context = (Resource)getConstantValue(sp.getContextVar());
      List<Value> key = Arrays.asList(subj, pred, obj, context);

      if (cardinalities.containsKey(key)) {
View Full Code Here

TOP

Related Classes of org.openrdf.model.URI

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.