Package org.apache.clerezza.rdf.core.access

Examples of org.apache.clerezza.rdf.core.access.LockableMGraph.filter()


    GraphNode result = new GraphNode(new BNode(), new UnionMGraph(resultGraph, contentGraph));
    RdfList list = new RdfList(result);   
    Lock l = contentGraph.getLock().readLock();
    l.lock();
    try {
      Iterator<Triple> greetings = contentGraph.filter(null, RDF.type, CURIE.CuriePrefixBinding);
      while (greetings.hasNext()) {
        list.add(greetings.next().getSubject());
      }
    } finally {
      l.unlock();
View Full Code Here


    }
    LockableMGraph systemGraph = getSystemGraph();
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      Iterator<Triple> triples = systemGraph.filter(null, FOAF.mbox,
          new UriRef("mailto:" + email));
      if (!triples.hasNext()) {
        return null;
      }
      NonLiteral user = triples.next().getSubject();
View Full Code Here

          new UriRef("mailto:" + email));
      if (!triples.hasNext()) {
        return null;
      }
      NonLiteral user = triples.next().getSubject();
      triples = systemGraph.filter(user, PLATFORM.userName, null);
      if (!triples.hasNext()) {
        throw new UserHasNoNameException("User with email address" + email
            + " does not have a name");
      }
      return ((PlainLiteral) triples.next().getObject()).getLexicalForm();
View Full Code Here

  public boolean nameExists(String name) {
    LockableMGraph systemGraph = getSystemGraph();
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      return systemGraph.filter(null, PLATFORM.userName,
        new PlainLiteralImpl(name)).hasNext();
    } finally {
      readLock.unlock();
    }   
  }
View Full Code Here

  public boolean emailExists(String email) {
    LockableMGraph systemGraph = getSystemGraph();
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      return systemGraph.filter(null, FOAF.mbox,
          new UriRef("mailto:" + email)).hasNext();
    } finally {
      readLock.unlock();
    }
  }
View Full Code Here

  private Iterator<NonLiteral> getResourcesOfType(UriRef type) {
    LockableMGraph systemGraph = getSystemGraph();
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      final Iterator<Triple> triples = systemGraph.filter(null, RDF.type, type);
      Set<NonLiteral> userRoles = new HashSet<NonLiteral>();
      while (triples.hasNext()) {
        userRoles.add(triples.next().getSubject());
      }
      return userRoles.iterator();
View Full Code Here

  }

  @Override
  public GraphNode getUserInContentGraph(final String name) {
    final LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
    Iterator<Triple> triples = contentGraph.filter(null, PLATFORM.userName,
        new PlainLiteralImpl(name));
    GraphNode resultNode = null;
    if (triples.hasNext()) {
      Lock readLock = contentGraph.getLock().readLock();
      readLock.lock();
View Full Code Here

  private NonLiteral getUserByUserName(String name) {
    LockableMGraph systemGraph = getSystemGraph();
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      Iterator<Triple> triples = systemGraph.filter(null, PLATFORM.userName,
          new PlainLiteralImpl(name));
      if (triples.hasNext()) {
        return triples.next().getSubject();
      }
      return null;
View Full Code Here

  public NonLiteral getRoleByTitle(String title) {
    LockableMGraph systemGraph = getSystemGraph();
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      Iterator<Triple> triples = systemGraph.filter(null, DC.title,
          new PlainLiteralImpl(title));
      NonLiteral role = null;
      while (triples.hasNext()) {
        role = triples.next().getSubject();
        if (systemGraph.filter(role, RDF.type, PERMISSION.Role).hasNext()) {
View Full Code Here

      Iterator<Triple> triples = systemGraph.filter(null, DC.title,
          new PlainLiteralImpl(title));
      NonLiteral role = null;
      while (triples.hasNext()) {
        role = triples.next().getSubject();
        if (systemGraph.filter(role, RDF.type, PERMISSION.Role).hasNext()) {
          return role;
        }
      }
    } finally {
      readLock.unlock();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.