Package org.apache.clerezza.rdf.core.impl

Examples of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl


    return AccessController.doPrivileged(new PrivilegedAction<Object>() {
      @Override
      public Object run() {
        GraphNode result = new GraphNode(new BNode(), new SimpleMGraph());
        result.addProperty(RDF.type, LOGIN.LoginPage);
        PlainLiteral failedMessage = new PlainLiteralImpl(
            "Username name or password are wrong");
        try {
          if (authenticationService.authenticateUser(userName,password)) {
            Set<LoginListener> tempLoginListenerSet = null;
            synchronized(loginListenerSet) {
View Full Code Here


    MGraph mGraph = new SimpleMGraph();
    UriRef mbox1 = new UriRef("mailto:foo@example.org");
    final BNode bNode1 = new BNode();
    mGraph.add(new TripleImpl(bNode1, FOAF.mbox, mbox1));
    mGraph.add(new TripleImpl(bNode1, RDFS.comment,
        new PlainLiteralImpl("a comment")));
    final BNode bNode2 = new BNode();
    mGraph.add(new TripleImpl(bNode2, FOAF.mbox, mbox1));
    mGraph.add(new TripleImpl(bNode2, RDFS.comment,
        new PlainLiteralImpl("another comment")));
    Smusher.smush(mGraph, ontology);
    Assert.assertEquals(3, mGraph.size());
  }
View Full Code Here

    MGraph mGraph = new SimpleMGraph();
    UriRef mbox1 = new UriRef("mailto:foo@example.org");
    final BNode bNode1 = new BNode();
    mGraph.add(new TripleImpl(bNode1, FOAF.mbox, mbox1));
    mGraph.add(new TripleImpl(bNode1, RDFS.comment,
        new PlainLiteralImpl("a comment")));
    final BNode bNode2 = new BNode();
    UriRef mbox2 = new UriRef("mailto:bar@example.org");
    mGraph.add(new TripleImpl(bNode2, FOAF.mbox, mbox1));
    mGraph.add(new TripleImpl(bNode2, FOAF.mbox, mbox2));
    mGraph.add(new TripleImpl(bNode2, RDFS.comment,
        new PlainLiteralImpl("another comment")));
    final BNode bNode3 = new BNode();
    mGraph.add(new TripleImpl(bNode3, FOAF.mbox, mbox2));
    mGraph.add(new TripleImpl(bNode3, RDFS.comment,
        new PlainLiteralImpl("yet another comment")));
    Smusher.smush(mGraph, ontology);
    Assert.assertEquals(5, mGraph.size());
  }
View Full Code Here

    MGraph mGraph = new SimpleMGraph();
    UriRef mbox1 = new UriRef("mailto:foo@example.org");
    final UriRef resource = new UriRef("http://example.org/");
    mGraph.add(new TripleImpl(resource, FOAF.mbox, mbox1));
    mGraph.add(new TripleImpl(resource, RDFS.comment,
        new PlainLiteralImpl("a comment")));
    final BNode bNode2 = new BNode();
    mGraph.add(new TripleImpl(bNode2, FOAF.mbox, mbox1));
    mGraph.add(new TripleImpl(bNode2, RDFS.comment,
        new PlainLiteralImpl("another comment")));
    Smusher.smush(mGraph, ontology);
    Assert.assertEquals(3, mGraph.size());
  }
View Full Code Here

    MGraph mGraph = new SimpleMGraph();
    UriRef mbox1 = new UriRef("mailto:foo@example.org");
    final UriRef resource1 = new UriRef("http://example.org/");
    mGraph.add(new TripleImpl(resource1, FOAF.mbox, mbox1));
    mGraph.add(new TripleImpl(resource1, RDFS.comment,
        new PlainLiteralImpl("a comment")));
    final UriRef resource2 = new UriRef("http://2.example.org/");
    mGraph.add(new TripleImpl(resource2, FOAF.mbox, mbox1));
    mGraph.add(new TripleImpl(resource2, RDFS.comment,
        new PlainLiteralImpl("another comment")));
    Smusher.smush(mGraph, ontology);
    Assert.assertEquals(4, mGraph.size());
  }
View Full Code Here

  }

  private NonLiteral getUserByName(String userName)
      throws UserUnregisteredException {
    Iterator<Triple> triples = systemGraph.filter(null, PLATFORM.userName,
        new PlainLiteralImpl(userName));

    if (triples.hasNext()) {
      return triples.next().getSubject();
    }
    throw new UserUnregisteredException(userName);
View Full Code Here

    while (permsForRole.hasNext()) {
      Iterator<Triple> javaPermForRole = systemGraph.filter(
          (BNode) permsForRole.next().getObject(),
          PERMISSION.javaPermissionEntry, null);
      if (javaPermForRole.hasNext()) {
        PlainLiteralImpl permissionEntry = (PlainLiteralImpl) javaPermForRole
            .next().getObject();
        String permission = permissionEntry.getLexicalForm();
        if(permission.contains("{username}")) {
          permission = permission.replace("{username}",userName);
        }
        result.add(permission);
      }
View Full Code Here

  @Test
  public void listCreationAndAccess() {
    TripleCollection tc = new SimpleMGraph();
    List<Resource> list = new RdfList(new UriRef("http://example.org/mytest"), tc);
    assertEquals(0, list.size());
    list.add(new PlainLiteralImpl("hello"));
    list.add(new PlainLiteralImpl("world"));
    assertEquals(new PlainLiteralImpl("hello"), list.get(0));
    assertEquals(new PlainLiteralImpl("world"), list.get(1));
    assertEquals(2, list.size());
    list.add(new PlainLiteralImpl("welcome"));
    assertEquals(3, list.size());
    assertEquals(new PlainLiteralImpl("welcome"), list.get(2));
    list.add(1, new PlainLiteralImpl("interesting"));
    assertEquals(4, list.size());
    assertEquals(new PlainLiteralImpl("interesting"), list.get(1));
    assertEquals(new PlainLiteralImpl("world"), list.get(2));
    assertEquals(new PlainLiteralImpl("welcome"), list.get(3));
    list.add(0, new PlainLiteralImpl("start"));
    assertEquals(5, list.size());
    assertEquals(new PlainLiteralImpl("hello"), list.get(1));
    assertEquals(new PlainLiteralImpl("interesting"), list.get(2));
    List<Resource> list2 = new RdfList(new UriRef("http://example.org/mytest"), tc);
    assertEquals(5, list2.size());
    assertEquals(new PlainLiteralImpl("hello"), list2.get(1));
    assertEquals(new PlainLiteralImpl("interesting"), list2.get(2));
    list2.remove(2);
    assertEquals(4, list2.size());
    assertEquals(new PlainLiteralImpl("hello"), list2.get(1));
    assertEquals(new PlainLiteralImpl("world"), list2.get(2));
    while (list2.size() > 0) {
      list2.remove(0);
    }
    assertEquals(1, tc.size()); //list = rdf:nil statement
    list2.add(0, new PlainLiteralImpl("restart"));
    list2.add(1, new PlainLiteralImpl("over"));
    assertEquals(2, list2.size());
    list2.add(new PlainLiteralImpl("2"));
    list2.add(new PlainLiteralImpl("3"));
    assertEquals(4, list2.size());
    list2.add(new PlainLiteralImpl("4"));
    list2.add(new PlainLiteralImpl("5"));
    assertEquals(new PlainLiteralImpl("3"), list2.get(3));
  }
View Full Code Here

    @Test
  public void listCreationAndAccess2() {
    TripleCollection tc = new SimpleMGraph();
    List<Resource> list = new RdfList(new UriRef("http://example.org/mytest"), tc);
    assertEquals(0, list.size());
    list.add(0,new PlainLiteralImpl("world"));
        list = new RdfList(new UriRef("http://example.org/mytest"), tc);
        list.add(0,new PlainLiteralImpl("beautifuly"));
        list = new RdfList(new UriRef("http://example.org/mytest"), tc);
        list.add(0,new PlainLiteralImpl("hello"));
        assertEquals(new PlainLiteralImpl("hello"), list.get(0));
        assertEquals(new PlainLiteralImpl("beautifuly"), list.get(1));
        assertEquals(new PlainLiteralImpl("world"), list.get(2));
    }
View Full Code Here

  private NonLiteral getAgentFromGraph(String userName) throws NoSuchAgent {
    NonLiteral agent;
    Lock l = systemGraph.getLock().readLock();
    l.lock();
    try {
      Iterator<Triple> agents = systemGraph.filter(null, PLATFORM.userName, new PlainLiteralImpl(userName));
      if (agents.hasNext()) {
        agent = agents.next().getSubject();
      } else {
        logger.debug("unsuccessful authentication attempt as non-existent user {}", userName);
        throw new NoSuchAgent();
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl

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.