Package org.ontoware.rdf2go.model.node

Examples of org.ontoware.rdf2go.model.node.URI


    }
   
    @Override
    public Model next() {
      RepositoryModel model = null;
      URI uri = this.contextIterator.next();
      model = new RepositoryModel(uri, RepositoryModelSet.this.repository);
      model.open();
      RepositoryModelSet.this.openModels.put(model, null);
      this.lastURI = uri;
      return model;
View Full Code Here


      return toOpenRDF((Variable)object, factory);
    } else
    // fix for RDFReactor compatibility
    if(object instanceof org.ontoware.rdf2go.model.node.Resource) {
      try {
        URI uri = ((org.ontoware.rdf2go.model.node.Resource)object).asURI();
        return toOpenRDF(uri, factory);
      } catch(ClassCastException e) {
        // if a resource is not a URI it must be a blank node
        BlankNode blankNode = ((org.ontoware.rdf2go.model.node.Resource)object)
                .asBlankNode();
View Full Code Here

        System.out.println(name);
      }
    }
    System.out.println("-----------------\n\n");

    URI tag = model.createURI("http://example.com/semweb4j#tag");
    URI name = model.createURI("http://example.com/semweb4j#name");

    System.out.println("all tagging statements:");
    ClosableIterator<? extends Statement> it = model.findStatements(Variable.ANY, tag,
        Variable.ANY);
    while (it.hasNext()) {
View Full Code Here

  }
 
  public static void main(String[] args) throws ModelRuntimeException {
    init();
   
    URI AURI = modelSet.createURI("http://example.com/models#A");
    URI BURI = modelSet.createURI("http://example.com/models#B");
   
    Model A = modelSet.getModel(AURI);
    Model B = modelSet.getModel(BURI);
    assert A.getContextURI() == AURI;
    assert B.getContextURI() == BURI;
View Full Code Here

    A.removeAll();
    B.removeAll();
    knows = A.createURI("http://example.com#knows");
    max = A.createURI("http://example.com#max");
    konrad = A.createURI("http://example.com#konrad");
    URI james = A.createURI("http://example.com#james");
    URI guido = A.createURI("http://example.com#guido");
    A.addStatement(max, knows, konrad);
    A.addStatement(konrad, knows, max);
    B.addStatement(max, knows, konrad);
    B.addStatement(guido, knows, james);
  }
View Full Code Here

      throw new RDFDataException(
          "Cannot convert a language tagged literal to an Short - it makes no sense");
    }

    if (node instanceof DatatypeLiteral) {
      URI datatype = node.asDatatypeLiteral().getDatatype();
      if (datatype.equals(XSD._short)) {
        return toShort(node.asDatatypeLiteral());
      } else {
        throw new RDFDataException("Cannot convert from datatype "
            + datatype + " to URI");
      }
View Full Code Here

      if (node instanceof PlainLiteral) {
        return new java.net.URL(node.asLiteral().getValue());
      }

      if (node instanceof DatatypeLiteral) {
        URI datatype = node.asDatatypeLiteral().getDatatype();
        if (datatype.equals(XSD._anyURI)) {
          return new java.net.URL(node.asDatatypeLiteral().getValue());
        } else {
          throw new RDFDataException("Cannot convert from datatype "
              + datatype + " to URI");
        }
View Full Code Here

      // log.debug("Ignoring language");
      return node.asLiteral().getValue();
    }

    if (node instanceof DatatypeLiteral) {
      URI datatype = node.asDatatypeLiteral().getDatatype();

      if (datatype.equals(XSD._string)
          || datatype.equals(XSD._normalizedString)) {
        return node.asDatatypeLiteral().getValue();
      } else {
        throw new RDFDataException("Cannot convert from datatype "
            + datatype + " to URI");
      }
View Full Code Here

  /* subclasses should overwrite this method for better performance */
  @Override
    public URI createURI(String uriString) throws ModelRuntimeException {
    // delegate to factory methods of the defaultModel
    Model defaultModel = this.getDefaultModel();
    URI uri = defaultModel.createURI(uriString);
    defaultModel.close();
    return uri;
  }
View Full Code Here

  /* subclasses should overwrite this method for better performance */
  @Override
    public URI newRandomUniqueURI() {
    Model defaultModel = this.getDefaultModel();
    URI result = defaultModel.newRandomUniqueURI();
    defaultModel.close();
    return result;

  }
View Full Code Here

TOP

Related Classes of org.ontoware.rdf2go.model.node.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.