Package org.apache.clerezza.rdf.core

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


        readLock.lock();
        try {
          Iterator<Triple> values = contentGraph.filter(contentUser,
              property, null);
          while (values.hasNext()) {
            PlainLiteral value = (PlainLiteral) values.next().getObject();
            resultGraph.add(new TripleImpl(customfield,
                CUSTOMPROPERTY.actualvalues, value));
          }
        } finally {
          readLock.unlock();
View Full Code Here


  @Override
  public boolean equals(Object otherObj) {
    if (!(otherObj instanceof PlainLiteral)) {
      return false;
    }
    PlainLiteral other = (PlainLiteral) otherObj;
    if (!lexicalForm.equals(other.getLexicalForm())) {
      return false;
    }
    if (language != null) {
      return language.equals(other.getLanguage());
    }
    if (other.getLanguage() != null) {
      return false;
    }
    return true;
  }
View Full Code Here

      readLock.lock();
    }
    try {
      Iterator<Resource> labels = resource.getObjects(RDFS.label);
      while (labels.hasNext()) {
        PlainLiteral label = (PlainLiteral) labels.next();
        if (label.getLanguage().equals(lang)) {
          return label.getLexicalForm();
        }
      }
      return null;
    } finally {
      if (readLock != null) {
View Full Code Here

    Iterator<Triple> languages = lingvojGraph.filter(null, RDFS.isDefinedBy, null);
    while (languages.hasNext()) {
      GraphNode languageNode = new GraphNode((UriRef) languages.next().getSubject(), lingvojGraph);
      Iterator<Resource> labels = languageNode.getObjects(RDFS.label);
      while (labels.hasNext()) {
        PlainLiteral label = (PlainLiteral) labels.next();
        if (label.getLanguage().equals(inLanguage) || inLanguage == null) {
          if (label.getLexicalForm().contains(languageName)) {
            return (UriRef) languageNode.getNode();
          }
        }
      }
    }
View Full Code Here

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

  }
 
  @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

   * 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

    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!")
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

TOP

Related Classes of org.apache.clerezza.rdf.core.PlainLiteral

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.