Package org.openrdf.model

Examples of org.openrdf.model.URI


      Value server = model.filter(implNode, SERVERURL, null).objectValue();
      Literal id = model.filter(implNode, REPOSITORYID, null).objectLiteral();
      if (server != null && id != null) {
        setURL(server.stringValue() + "/repositories/" + id.stringValue());
      }
      URI uri = model.filter(implNode, REPOSITORYURL, null).objectURI();
      if (uri != null) {
        setURL(uri.toString());
      }
      Literal username = model.filter(implNode, USERNAME, null).objectLiteral();
      if (username != null) {
        setUsername(username.getLabel());
      }
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 {
      if (!headerWritten) {
        writeHeader();
      }

      if (!nodeStack.isEmpty() && !subj.equals(nodeStack.peek().getValue())) {
        // Different subject than we had before, empty the stack
        // until we find it
        popStacks(subj);
      }

      // Stack is either empty or contains the same subject at top

      if (nodeStack.isEmpty()) {
        // Push subject
        nodeStack.push(new Node(subj));
      }

      // Stack now contains at least one element
      Node topSubject = nodeStack.peek();

      // Check if current statement is a type statement and use a typed node
      // element is possible
      // FIXME: verify that an XML namespace-qualified name can be created
      // for the type URI
      if (pred.equals(RDF.TYPE) && obj instanceof URI && !topSubject.hasType() && !topSubject.isWritten())
      {
        // Use typed node element
        topSubject.setType((URI)obj);
      }
      else {
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 {
      if (subj.equals(lastWrittenSubject)) {
        if (pred.equals(lastWrittenPredicate)) {
          // Identical subject and predicate
          writer.write(" , ");
        }
        else {
          // Identical subject, new predicate
View Full Code Here

      // We cannot use abbreviated syntax
      writeStartOfStartTag(RDF.NAMESPACE, "Description");
    }

    if (value instanceof URI) {
      URI uri = (URI)value;
      writeAttribute(RDF.NAMESPACE, "about", relativize(uri.stringValue()));
    }
    else {
      BNode bNode = (BNode)value;
      writeAttribute(RDF.NAMESPACE, "nodeID", bNode.getID());
    }
View Full Code Here

    if (obj instanceof Resource) {
      Resource objRes = (Resource)obj;

      if (objRes instanceof URI) {
        URI uri = (URI)objRes;
        writeAttribute(RDF.NAMESPACE, "resource", relativize(uri.stringValue()));
      }
      else {
        BNode bNode = (BNode)objRes;
        writeAttribute(RDF.NAMESPACE, "nodeID", bNode.getID());
      }

      writeEndOfEmptyTag();
    }
    else if (obj instanceof Literal) {
      Literal objLit = (Literal)obj;

      // language attribute
      if (objLit.getLanguage() != null) {
        writeAttribute("xml:lang", objLit.getLanguage());
      }

      // datatype attribute
      boolean isXmlLiteral = false;
      URI datatype = objLit.getDatatype();
      if (datatype != null) {
        // Check if datatype is rdf:XMLLiteral
        isXmlLiteral = datatype.equals(RDF.XMLLITERAL);

        if (isXmlLiteral) {
          writeAttribute(RDF.NAMESPACE, "parseType", "Literal");
        }
        else {
          writeAttribute(RDF.NAMESPACE, "datatype", datatype.toString());
        }
      }

      writeEndOfStartTag();
View Full Code Here

    verifyCharacter(read(), ":");

    skipWSC();

    // Read the namespace URI
    URI namespace = parseURI();

    // Store and report this namespace mapping
    String prefixStr = prefixID.toString();
    String namespaceStr = namespace.toString();

    setNamespace(prefixStr, namespaceStr);

    rdfHandler.handleNamespace(prefixStr, namespaceStr);
  }
View Full Code Here

  protected void parseBase()
    throws IOException, RDFParseException, RDFHandlerException
  {
    skipWSC();

    URI baseURI = parseURI();

    setBaseURI(baseURI.toString());
  }
View Full Code Here

    else {
      BNode listRoot = createBNode();

      // Remember current subject and predicate
      Resource oldSubject = subject;
      URI oldPredicate = predicate;

      // generated bNode becomes subject, predicate becomes rdf:first
      subject = listRoot;
      predicate = RDF.FIRST;
View Full Code Here

    if (c != ']') {
      unread(c);

      // Remember current subject and predicate
      Resource oldSubject = subject;
      URI oldPredicate = predicate;

      // generated bNode becomes subject
      subject = bNode;

      // Enter recursion with nested predicate-object list
View Full Code Here

  protected Literal parseNumber()
    throws IOException, RDFParseException
  {
    StringBuilder value = new StringBuilder(8);
    URI datatype = XMLSchema.INTEGER;

    int c = read();

    // read optional sign character
    if (c == '+' || c == '-') {
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.