Package org.openrdf.model

Examples of org.openrdf.model.Resource


   *         its return value is not a URI.
   */
  public static URI getOptionalSubjectURI(Model model, URI pred, Value obj, Resource... contexts)
    throws ModelException
  {
    Resource subject = getOptionalSubject(model, pred, obj, contexts);

    if (subject instanceof URI) {
      return (URI)subject;
    }
    else {
View Full Code Here


    sailImplConfig.validate();
  }

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

    if (sailImplConfig != null) {
      Resource sailImplNode = sailImplConfig.export(model);
      model.add(repImplNode, SAILIMPL, sailImplNode);
    }

    return repImplNode;
  }
View Full Code Here

  @Override
  public void parse(Model model, Resource repImplNode)
    throws StoreConfigException
  {
    try {
      Resource sailImplNode = model.filter(repImplNode, SAILIMPL, null).objectResource();

      if (sailImplNode != null) {
        Literal typeLit = model.filter(sailImplNode, SAILTYPE, null).objectLiteral();

        if (typeLit != null) {
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);
      }
View Full Code Here

    throws IOException
  {
    writeStartOfStartTag(pred.getNamespace(), pred.getLocalName());

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

      if (objRes instanceof URI) {
        URI uri = (URI)objRes;
        writeAttribute(RDF.NAMESPACE, "resource", relativize(uri.stringValue()));
      }
View Full Code Here

    }
  }

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

    if (url != null) {
      model.add(implNode, REPOSITORYURL, vf.createURI(url));
    }
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 {
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

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

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

      // generated bNode becomes subject
      subject = bNode;
View Full Code Here

        store.getCurrentSnapshot(), ReadMode.COMMITTED, vf);

    try {
      MemStatement st;
      while ((st = stIter.next()) != null) {
        Resource context = st.getContext();

        if (st.isExplicit()) {
          if (context == null) {
            dataOut.writeByte(EXPL_TRIPLE_MARKER);
          }
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.