Examples of PlainLiteral


Examples of org.apache.clerezza.rdf.core.PlainLiteral

public class PlainLiteralImplTest {

 
  @Test public void plainLiteralEquality() {
    String stringValue = "some text";
    PlainLiteral literal1 = new PlainLiteralImpl(stringValue);
    PlainLiteral literal2 = new PlainLiteralImpl(stringValue);   
    Assert.assertEquals(literal1, literal2);
    Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
    PlainLiteral literal3 = new PlainLiteralImpl("something else");
    Assert.assertFalse(literal1.equals(literal3));
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.PlainLiteral

  }
 
  @Test public void languageLiteralEquality() {
    String stringValue = "some text";
    Language lang = new Language("en-ca");
    PlainLiteral literal1 = new PlainLiteralImpl(stringValue, lang);
    PlainLiteral literal2 = new PlainLiteralImpl(stringValue, lang);   
    Assert.assertEquals(literal1, literal2);
    Assert.assertEquals(literal1.hashCode(), literal2.hashCode());
    Language lang2 = new Language("de");
    PlainLiteral literal3 = new PlainLiteralImpl(stringValue, lang2);
    Assert.assertFalse(literal1.equals(literal3));
    PlainLiteral literal4 = new PlainLiteralImpl(stringValue, null);
    Assert.assertFalse(literal3.equals(literal4));
    Assert.assertFalse(literal4.equals(literal3));
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.PlainLiteral

   * hashCode of the lexical form plus the hashCode of the locale
   */
  @Test public void checkHashCode() {
    String stringValue = "some text";
    Language language = new Language("en");
    PlainLiteral literal = new PlainLiteralImpl(stringValue, language);
    Assert.assertEquals(stringValue.hashCode() + language.hashCode(), literal.hashCode());
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.PlainLiteral

    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

Examples of org.apache.clerezza.rdf.core.PlainLiteral

      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!")
View Full Code Here

Examples of org.apache.clerezza.rdf.core.PlainLiteral

    @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

Examples of org.apache.clerezza.rdf.core.PlainLiteral

    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

Examples of org.apache.clerezza.rdf.core.PlainLiteral

   * @return permission node
   */
  private NonLiteral getPermissionOfAJavaPermEntry(
      String permissionString) {
    LockableMGraph systemGraph = getSystemGraph();
    PlainLiteral javaPermEntry = new PlainLiteralImpl(permissionString);
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      Iterator<Triple> javaPermTriples = systemGraph.filter(null,
          PERMISSION.javaPermissionEntry, javaPermEntry);
View Full Code Here

Examples of org.apache.clerezza.rdf.core.PlainLiteral

      sb.append("^^<");
      escapeUtf8ToUsAscii(
          typedLiteral.getDataType().getUnicodeString(), sb, false);
      sb.append(">");
    } else if(literal instanceof PlainLiteral) {
      PlainLiteral plainLiteral = (PlainLiteral) literal;
      if(plainLiteral.getLanguage() != null &&
          !plainLiteral.getLanguage().toString().equals("")) {

        sb.append("@");
        sb.append(plainLiteral.getLanguage().toString());
      }
    }

    sb.append(" ");
View Full Code Here

Examples of org.apache.clerezza.rdf.core.PlainLiteral

        if (random <= i) {
          mGraph.add(new TripleImpl(subject, predicate, lf.createTypedLiteral(count)));
        } else if (random <= d) {
          mGraph.add(new TripleImpl(subject, predicate, lf.createTypedLiteral(random)));
        } else {
          PlainLiteral text;
          if (random <= i) {
            text = new PlainLiteralImpl("Literal for " + count);
          } else if (random <= d) {
            text = new PlainLiteralImpl("An English literal for " + count, EN);
          } else {
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.