Package org.openrdf.model

Examples of org.openrdf.model.URI


      if (!XMLUtil.isNCName(id)) {
        reportError("Not an XML Name: " + id);
      }
    }

    URI uri = resolveURI("#" + id);

    if (verifyData()) {
      // ID (URI) should be unique in the current document

      if (!usedIDs.add(uri)) {
View Full Code Here


      int subjID = ByteArrayUtil.getInt(nextValue, TripleStore.SUBJ_IDX);
      Resource subj = (Resource)valueStore.getValue(subjID);

      int predID = ByteArrayUtil.getInt(nextValue, TripleStore.PRED_IDX);
      URI pred = (URI)valueStore.getValue(predID);

      int objID = ByteArrayUtil.getInt(nextValue, TripleStore.OBJ_IDX);
      Value obj = valueStore.getValue(objID);

      Resource context = null;
View Full Code Here

          if (datatype == null) {
            reportError(DATATYPE_ATT + " attribute missing for typed literal");
            valueList.add(createLiteral(text, null, null));
          }
          else {
            URI dtURI = createURI(datatype);
            valueList.add(createLiteral(text, null, dtURI));
          }
        }
        else if (tagName.equals(TRIPLE_TAG)) {
          if (parsingContext) {
View Full Code Here

          reportError("exactly 3 values are required for a triple");
          return;
        }

        Resource subj;
        URI pred;
        Value obj;

        try {
          subj = (Resource)valueList.get(0);
        }
View Full Code Here

      throws StoreException
    {
      super.meet(sp);

      Resource subj = (Resource)sp.getSubjectVar().getValue();
      URI pred = (URI)sp.getPredicateVar().getValue();
      Value obj = sp.getObjectVar().getValue();

      Resource[] ctx;
      Var contextVar = sp.getContextVar();
      if (contextVar == null || !contextVar.hasValue()) {
View Full Code Here

    @Override
    public void meet(StatementPattern node)
      throws StoreException
    {
      super.meet(node);
      URI pred = (URI)node.getPredicateVar().getValue();
      if (pred != null && localSpace != null && localSpace.match(pred.stringValue())) {
        local(node.getSubjectVar());
      }
      else {
        notLocal();
      }
View Full Code Here

  private NativeLiteral data2literal(int id, byte[] data)
    throws IOException
  {
    // Get datatype
    int datatypeID = ByteArrayUtil.getInt(data, 1);
    URI datatype = null;
    if (datatypeID != NativeValue.UNKNOWN_ID) {
      datatype = (URI)getValue(datatypeID);
    }

    // Get language tag
View Full Code Here

    @Override
    protected double getCardinality(StatementPattern sp)
      throws StoreException
    {
      Resource subj = (Resource)getConstantValue(sp.getSubjectVar());
      URI pred = (URI)getConstantValue(sp.getPredicateVar());
      Value obj = getConstantValue(sp.getObjectVar());
      Resource context = (Resource)getConstantValue(sp.getContextVar());

      try {
        return nativeStore.cardinality(subj, pred, obj, context);
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();

    // Verify that an XML namespace-qualified name can be created for the
    // predicate
    String predString = pred.toString();
    int predSplitIdx = XMLUtil.findURISplitIndex(predString);
    if (predSplitIdx == -1) {
      throw new RDFHandlerException("Unable to create XML namespace-qualified name for predicate: "
          + predString);
    }

    String predNamespace = predString.substring(0, predSplitIdx);
    String predLocalName = predString.substring(predSplitIdx);

    try {
      if (!headerWritten) {
        writeHeader();
      }

      // SUBJECT
      if (!subj.equals(lastWrittenSubject)) {
        flushPendingStatements();

        // Write new subject:
        writeNewLine();
        writeStartOfStartTag(RDF.NAMESPACE, "Description");
        if (subj instanceof BNode) {
          BNode bNode = (BNode)subj;
          writeAttribute(RDF.NAMESPACE, "nodeID", bNode.getID());
        }
        else {
          URI uri = (URI)subj;
          writeAttribute(RDF.NAMESPACE, "about", uri.toString());
        }
        writeEndOfStartTag();
        writeNewLine();

        lastWrittenSubject = subj;
      }

      // PREDICATE
      writeIndent();
      writeStartOfStartTag(predNamespace, predLocalName);

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

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

        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

    // see if we should try and find a value from the supplied resource's
    // parent.
    if (result == null && inherit) {
      visited.add(subject);
      URI inheritanceProperty = getInheritanceProperty();

      if (inheritanceProperty != null) {
        Cursor<? extends Statement> parentStatements = super.getStatements(subject, inheritanceProperty,
            null, true);
        try {
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.