Package org.openrdf.model

Examples of org.openrdf.model.Resource


        if (valueList.size() != 3) {
          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


    public void meet(StatementPattern sp)
      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();
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);
      }
      catch (IOException e) {
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());
        }
View Full Code Here

    this.forceSync = forceSync;
  }

  @Override
  public Resource export(Model model) {
    Resource implNode = super.export(model);

    ValueFactoryImpl vf = ValueFactoryImpl.getInstance();

    if (tripleIndexes != null) {
      model.add(implNode, TRIPLE_INDEXES, vf.createLiteral(tripleIndexes));
View Full Code Here

        // Any context matches
        return true;
      }
      else {
        // Accept if one of the contexts from the pattern matches
        Resource stContext = st.getContext();

        for (Resource context : contexts) {
          if (context == null && stContext == null) {
            return true;
          }
View Full Code Here

    s.defaultWriteObject();
    // Write in size
    s.writeInt(statements.size());
    // Write in all elements
    for (ModelStatement st : statements) {
      Resource subj = st.getSubject();
      URI pred = st.getPredicate();
      Value obj = st.getObject();
      Resource ctx = st.getContext();
      s.writeObject(new StatementImpl(subj, pred, obj, ctx));
    }
  }
View Full Code Here

      add(st);
    }
  }

  private Iterator find(Statement st) {
    Resource subj = st.getSubject();
    URI pred = st.getPredicate();
    Value obj = st.getObject();
    Resource ctx = st.getContext();
    return match(subj, pred, obj, ctx);
  }
View Full Code Here

    }
  }

  @Override
  public Resource export(Model model) {
    Resource implNode = super.export(model);

    ValueFactory vf = ValueFactoryImpl.getInstance();

    for (RepositoryImplConfig member : members) {
      model.add(implNode, MEMBER, member.export(model));
View Full Code Here

        stmts.close();
      }
      getDelegate().removeMatch(subj, pred, obj, ctx);
      for (RepositoryConnectionListener listener : listeners) {
        for (Statement stmt : list) {
          Resource s = stmt.getSubject();
          URI p = stmt.getPredicate();
          Value o = stmt.getObject();
          Resource c = stmt.getContext();
          listener.remove(this, s, p, o, c);
        }
      }
    }
    else if (activated) {
View Full Code Here

TOP

Related Classes of org.openrdf.model.Resource

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.