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

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


  @Test
  public void compareFunctionResultInIf() throws IOException {
    TripleCollection mGraph = new SimpleMGraph();
    NonLiteral resource = new BNode();
    mGraph.add(new TripleImpl(resource, RDFS.comment, new PlainLiteralImpl("a resource")));
    GraphNode node = new GraphNode(resource, mGraph);
    DataFieldResolver dataFieldResolver = new GraphNodeDataFieldResolver(node, simpleFunctions);

    StringReader reader = new StringReader("${ns:rdfs=http://www.w3.org/2000/01/rdf-schema#}" +
        "${if getAudio(\"foo/bar\") = \"audio\"}noproblem${/if}");
View Full Code Here


    NonLiteral listNode1 = new BNode() {
    };
    mGraph.add(new TripleImpl(resource, RDF.value, listNode1));
    List<Resource> list1 = new RdfList(listNode1, mGraph);
    list1.add(new PlainLiteralImpl("first"));
    list1.add(new PlainLiteralImpl("second"));
    list1.add(new PlainLiteralImpl("third"));

    NonLiteral listNode2 = new BNode() {
    };
    mGraph.add(new TripleImpl(resource, RDF.value, listNode2));
    RdfList.createEmptyList(listNode2, mGraph);
View Full Code Here

    Assert.assertEquals("\"first\"\"second\"\"third\"", writer.toString());
  }

  private NonLiteral createLabeledRes(String label, TripleCollection mGraph) {
    BNode bNode = new BNode();
    PlainLiteral lit = new PlainLiteralImpl(label);
    mGraph.add(new TripleImpl(bNode, RDFS.label, lit));
    return bNode;
  }
View Full Code Here

      return Response.status(Status.BAD_REQUEST)
          .entity("A concept must have a label!")
          .build();
    }
    MGraph contentGraph = cgProvider.getContentGraph();
    PlainLiteral preferredLabel = new PlainLiteralImpl(prefLabel,
        new Language(lang));

    if (contentGraph.filter(null, SKOS.prefLabel, preferredLabel).hasNext()) {
      return Response.status(Status.CONFLICT)
          .entity("A concept with the same label and language already exists!")
          .build();
    }
   
    UriRef concept = getConceptUriRef(platformConfig, prefLabel);
    contentGraph.add(new TripleImpl(concept, RDF.type,
        SKOS.Concept));
    String baseUri = platformConfig.getDefaultBaseUri().getUnicodeString();
    contentGraph.add(new TripleImpl(concept, SKOS.inScheme,
        new UriRef(baseUri + FREE_CONCEPT_SCHEME)));
    contentGraph.add(new TripleImpl(concept, SKOS.prefLabel, preferredLabel));
    if (!comment.isEmpty()) {
      contentGraph.add(new TripleImpl(concept, RDFS.comment,
          new PlainLiteralImpl(comment, new Language(lang))));
    }
    return Response.status(Status.CREATED).entity(concept.getUnicodeString())
        .build();
  }
View Full Code Here

    @GET
    @Path("success")
    public GraphNode logoutSuccessPage(@Context UriInfo uriInfo) {
  TrailingSlash.enforcePresent(uriInfo);
  GraphNode result = new GraphNode(new BNode(), new SimpleMGraph());
  PlainLiteral message = new PlainLiteralImpl(
    "You successfully logged out.");
  result.addProperty(LOGIN.message, message);
  result.addProperty(RDF.type, LOGIN.LoginPage);

  String baseUri = uriInfo.getBaseUri().getScheme() + "://"
View Full Code Here

    MGraph g = new SimpleMGraph();
    BNode bNode1 = new BNode() {};
    BNode bNode2 = new BNode() {};
    UriRef property1 = new UriRef("http://example.org/property1");
    UriRef property2 = new UriRef("http://example.org/property2");
    g.add(new TripleImpl(bNode1, property1, new PlainLiteralImpl("literal")));
    g.add(new TripleImpl(bNode1, property2, property1));
    g.add(new TripleImpl(bNode2, property2, bNode1));
    g.add(new TripleImpl(property1, property1, bNode2));
    g.add(new TripleImpl(property1, property1, new PlainLiteralImpl("bla bla")));
    GraphNode n = new GraphNode(bNode1, g);
    Assert.assertEquals(4, n.getNodeContext().size());
    n.deleteNodeContext();
    Assert.assertEquals(1, g.size());
    Assert.assertFalse(n.getObjects(property2).hasNext());
View Full Code Here

    BNode bNode1 = new BNode() {};
    BNode bNode2 = new BNode() {};
    UriRef property1 = new UriRef("http://example.org/property1");
    UriRef property2 = new UriRef("http://example.org/property2");
    //the two properties two be deleted
    g.add(new TripleImpl(bNode1, property1, new PlainLiteralImpl("literal")));
    g.add(new TripleImpl(bNode1, property1, new PlainLiteralImpl("bla bla")));
    //this 3 properties should stay
    g.add(new TripleImpl(bNode1, property2, property1));
    g.add(new TripleImpl(property1, property1, new PlainLiteralImpl("bla bla")));
    g.add(new TripleImpl(bNode2, property1, new PlainLiteralImpl("bla bla")));
    GraphNode n = new GraphNode(bNode1, g);
    n.deleteProperties(property1);
    Assert.assertEquals(3, g.size());
  }
View Full Code Here

    BNode bNode1 = new BNode() {};
    BNode bNode2 = new BNode() {};
    UriRef property1 = new UriRef("http://example.org/property1");
    UriRef property2 = new UriRef("http://example.org/property2");
    //the properties two be deleted
    g.add(new TripleImpl(bNode1, property1, new PlainLiteralImpl("literal")));
    //this 4 properties should stay
    g.add(new TripleImpl(bNode1, property1, new PlainLiteralImpl("bla bla")));
    g.add(new TripleImpl(bNode1, property2, property1));
    g.add(new TripleImpl(property1, property1, new PlainLiteralImpl("bla bla")));
    g.add(new TripleImpl(bNode2, property1, new PlainLiteralImpl("bla bla")));
    GraphNode n = new GraphNode(bNode1, g);
    n.deleteProperty(property1, new PlainLiteralImpl("literal"));
    Assert.assertEquals(4, g.size());
  }
View Full Code Here

    BNode bNode2 = new BNode();
    BNode newBnode = new BNode();
    UriRef property1 = new UriRef("http://example.org/property1");
    UriRef property2 = new UriRef("http://example.org/property2");
    UriRef newUriRef = new UriRef("http://example.org/newName");
    Literal literal1 = new PlainLiteralImpl("literal");
    Literal literal2 = new PlainLiteralImpl("bla bla");

    Triple triple1 = new TripleImpl(bNode1, property1, literal1);
    Triple triple2 = new TripleImpl(bNode1, property2, property1);
    Triple triple3 = new TripleImpl(bNode2, property2, bNode1);
    Triple triple4 = new TripleImpl(property1, property1, bNode2);
View Full Code Here

    result.addProperty(LOGIN.refererUri, new UriRef(refererUri));
    String user = getUserName();
    if (!user.equals("anonymous") && cause != null &&
        cause.equals(CookieAuthentication.NOT_ENOUGH_PERMISSIONS)) {
      try {
        result.addProperty(LOGIN.message, new PlainLiteralImpl("The user " +
            user + " does not have the required permissions to view this page" +
            " (" + URLDecoder.decode(refererUri, "UTF-8") + ")." +
            " Please log in as another user."));
      } catch (UnsupportedEncodingException ex) {
        throw new RuntimeException(ex);
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.