Package org.openrdf.model

Examples of org.openrdf.model.Resource


    protected class MemCardinalityCalculator extends CardinalityCalculator {

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

        // Perform look-ups for value-equivalents of the specified values
        MemResource memSubj = vf.getMemResource(subj);
        MemURI memPred = vf.getMemURI(pred);
        MemValue memObj = vf.getMemValue(obj);
View Full Code Here


  public RdbmsStatement asRdbmsStatement(Statement stmt) {
    if (stmt instanceof RdbmsStatement) {
      return (RdbmsStatement)stmt;
    }
    Resource s = stmt.getSubject();
    URI p = stmt.getPredicate();
    Value o = stmt.getObject();
    Resource c = stmt.getContext();
    return createStatement(s, p, o, c);
  }
View Full Code Here

    }
  }

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

    ValueFactory vf = ValueFactoryImpl.getInstance();

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

    if (!writingStarted) {
      throw new RuntimeException("Document writing has not yet been started");
    }

    try {
      Resource context = st.getContext();

      if (inActiveContext && !contextsEquals(context, currentContext)) {
        closePreviousStatement();
        closeActiveContext();
      }
View Full Code Here

      Cursor<? extends Statement> toBeRemovedStatements = super.getStatements(null, pred, obj, false,
          contexts);
      try {
        Statement st;
        while ((st = toBeRemovedStatements.next()) != null) {
          Resource subject = st.getSubject();

          if (isEditable(subject)) {
            super.removeStatements(subject, pred, obj, contexts);
          }
          else if (isViewable(subject)) {
            // Since the user did not explicitly specify the subject being
            // removed, we silently ignore the statement if the subject is
            // not viewable by the user.
            throw new StoreException("insufficient access rights on subject " + subject.stringValue());
          }
        }
      }
      finally {
        toBeRemovedStatements.close();
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) {
        header();
      }
      // can only be about baseURI subject
      // can't have nested BNodes in header
      if (inHeader && isAbout(subj)) {
        if (obj instanceof URI) {
          String relativize = relativize(obj.stringValue());
          writer.handleMetaLink(pred, relativize);
          return;
        }
        else if (obj instanceof Literal) {
          writer.handleMetaAttribute(pred, (Literal)obj);
          return;
        }
      }
      else if (inHeader) {
        flush();
        body();
      }

      if (!nodeStack.isEmpty() && !subj.equals(nodeStack.peek().getValue())) {
        // New subject, empty the stack
        popStacks(subj);
      }
      else if (nodeStack.size() > 1 && subj instanceof URI) {
        // New subject, empty the stack
View Full Code Here

    // loop detection
    if (visited.contains(subject)) {
      return null;
    }

    Resource result = null;

    Cursor<? extends Statement> statements = super.getStatements(subject, predicate, null, true, contexts);
    try {
      Statement st;
      while ((st = statements.next()) != null) {
View Full Code Here

  }

  private URI getAttributeValueForPermission(URI permission, URI attribute)
    throws StoreException
  {
    Resource match = getPropertyResourceValue(permission, ACL.HAS_MATCH, false, ACL.CONTEXT);
    URI attributeValue = (URI)getPropertyResourceValue(match, attribute, false, ACL.CONTEXT);
    return attributeValue;
  }
View Full Code Here

          false, ACL.CONTEXT);

      try {
        Statement st;
        while ((st = statements.next()) != null) {
          Resource subject = st.getSubject();
          if (subject instanceof URI) {
            accessAttributes.add((URI)subject);
          }
        }
      }
View Full Code Here

        try {
          if (contexts.hasNext()) {
            writeln("+----------");
            while (contexts.hasNext()) {
              Resource context = contexts.next();
              writeln("|" + context.toString());
            }
            writeln("+----------");
          }
          else {
            writeln("--no contexts found--");
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.