Examples of PlainLiteralImpl


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

    @Test
    public void serializeGraph() {
        final String uriString = "http://example.org/foo#bar";
        UriRef uri = new UriRef(uriString);
        MGraph mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uri, uri, new PlainLiteralImpl("bla bla")));
        com.hp.hpl.jena.graph.Graph graph = new JenaGraph(mGraph);
        Model model = ModelFactory.createModelForGraph(graph);
        StringWriter writer = new StringWriter();
        model.write(writer);
        Assert.assertTrue(writer.toString().contains("about=\""+uriString));
View Full Code Here

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

   
    @Test
    public void graphSize() {
        UriRef uri = new UriRef("http://example.org/foo#bar");
        MGraph mGraph = new SimpleMGraph();
        mGraph.add(new TripleImpl(uri, uri, new PlainLiteralImpl("bla bla")));
        com.hp.hpl.jena.graph.Graph graph = new JenaGraph(mGraph);
        Assert.assertEquals(1, graph.size());
    }
View Full Code Here

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

            case 0:
                return new BNode();
            case 1:
                return createRandomUriRef();
            case 2:
                return new PlainLiteralImpl(RandomStringUtils.random(rollDice(100) + 1));
        }
        throw new RuntimeException("in createRandomResource()");
    }
View Full Code Here

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

    @Test
    public void testUseLanguageLiterals() {
        MGraph graph = getEmptyMGraph();
        Assert.assertEquals(0, graph.size());
        Language language = new Language("it");
        Literal value = new PlainLiteralImpl("<elem>value</elem>",language);
        final TripleImpl triple1 = new TripleImpl(uriRef1, uriRef2, value);
        graph.add(triple1);
        Iterator<Triple> tripleIter = graph.filter(uriRef1, uriRef2, null);
        Assert.assertTrue(tripleIter.hasNext());
        Resource gotValue = tripleIter.next().getObject();
View Full Code Here

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

    @Test
    public void testGetSameBNode() throws Exception {
        MGraph graph = getEmptyMGraph();
        BNode bNode = new BNode();
        final UriRef HAS_NAME = new UriRef("http://example.org/ontology/hasName");
        final PlainLiteralImpl name = new PlainLiteralImpl("http://example.org/people/alice");
        final PlainLiteralImpl name2 = new PlainLiteralImpl("http://example.org/people/bob");
        final Triple tripleAlice = new TripleImpl(bNode, HAS_NAME, name);
        final Triple tripleBob = new TripleImpl(bNode, HAS_NAME, name2);
        Assert.assertTrue(graph.add(tripleAlice));
        Assert.assertTrue(graph.add(tripleBob));
        Iterator<Triple> result = graph.filter(null, HAS_NAME, name);
View Full Code Here

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

   
    Lock writeLock = contentGraph.getLock().writeLock();
    writeLock.lock();
    try {
      contentGraph.add(new TripleImpl(user, RDF.type, FOAF.Agent));
      contentGraph.add(new TripleImpl(user, PLATFORM.userName, new PlainLiteralImpl(
          userName)));
    } finally {
      writeLock.unlock();
    }
View Full Code Here

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

  private NonLiteral getCustomUser(LockableMGraph contentGraph, String userName) {
    Lock readLock = contentGraph.getLock().readLock();
    readLock.lock();
    try {
      Iterator<Triple> users = contentGraph.filter(null, PLATFORM.userName,
          new PlainLiteralImpl(userName.trim()));
      if (users.hasNext()) {
        return users.next().getSubject();
      } else {
        return null;
      }
View Full Code Here

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

      BNode providedPermission = new BNode();
      resultGraph.add(new TripleImpl(userPermissionPage,
          USERMANAGER.permission, providedPermission));

      resultGraph.add(new TripleImpl(providedPermission,
          PERMISSION.javaPermissionEntry, new PlainLiteralImpl(desc.getJavaPermissionString())));

      resultGraph.add(new TripleImpl(providedPermission,
          DCTERMS.title, new PlainLiteralImpl(desc.getSimpleName())));

      resultGraph.add(new TripleImpl(providedPermission,
          DCTERMS.description, new PlainLiteralImpl(desc.getDescription())));
   
    resultGraph.add(new TripleImpl(userPermissionPage, RDF.type,
        PLATFORM.HeadedPage));
    resultGraph.add(new TripleImpl(userPermissionPage, RDF.type,
        USERMANAGER.UserPermissionPage));
View Full Code Here

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

      PermissionDescripton desc = permDescs.next();
      BNode providedPermission = new BNode();
      resultGraph.add(new TripleImpl(rolePermissionPage,
          USERMANAGER.permission, providedPermission));
      resultGraph.add(new TripleImpl(providedPermission,
          PERMISSION.javaPermissionEntry, new PlainLiteralImpl(desc.getJavaPermissionString())));
      resultGraph.add(new TripleImpl(providedPermission,
          DCTERMS.title, new PlainLiteralImpl(desc.getSimpleName())));
      resultGraph.add(new TripleImpl(providedPermission,
          DCTERMS.description, new PlainLiteralImpl(desc.getDescription())));
    }

    resultGraph.add(new TripleImpl(rolePermissionPage, RDF.type,
        PLATFORM.HeadedPage));
    resultGraph.add(new TripleImpl(rolePermissionPage, RDF.type,
View Full Code Here

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

        USERMANAGER.AddCustomPropertyPage));
    resultGraph.add(new TripleImpl(node, RDF.type,
        PLATFORM.HeadedPage));

    resultGraph.add(new TripleImpl(node, USERMANAGER.role,
        new PlainLiteralImpl(role)));
    return new GraphNode(node, resultGraph);
  }
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.