Examples of PlainLiteralImpl


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

   
 
  @Test public void tripleEquality() {
    NonLiteral subject = new UriRef("http://example.org/");
    UriRef predicate = new UriRef("http://example.org/property");
    Resource object = new PlainLiteralImpl("property value");
    Triple triple1 = new TripleImpl(subject, predicate, object);
    Triple triple2 = new TripleImpl(subject, predicate, object);
    Assert.assertEquals(triple1.hashCode(), triple2.hashCode());
    Assert.assertEquals(triple1, triple2)
  }
View Full Code Here

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

    NonLiteral result = new BNode();
    RdfList list = new RdfList(result, mGraph);
    for (Menu menu : menus) {
      BNode node = new BNode();
      final String label = menu.root.getLabel();
      Literal labelLiteral = new PlainLiteralImpl(label);
      mGraph.add(new TripleImpl(node, RDFS.label,labelLiteral));
      final String description = menu.root.getDescription();
      if (description != null) {
        Literal descLiteral = new PlainLiteralImpl(description);
        mGraph.add(new TripleImpl(node, DCTERMS.description, descLiteral));
      }
      final String path = menu.root.getPath();
      if (path != null) {
        Literal pathLiteral = LiteralFactory.getInstance().
View Full Code Here

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

    NonLiteral result = new BNode();
    RdfList list = new RdfList(result, mGraph);
    for (GlobalMenuItem item : menus) {
      BNode node = new BNode();
      final String label = item.getLabel();
      Literal labelLiteral = new PlainLiteralImpl(label);
      mGraph.add(new TripleImpl(node, RDFS.label,labelLiteral));
      final String description = item.getDescription();
      if (description != null) {
        Literal descLiteral = new PlainLiteralImpl(description);
        mGraph.add(new TripleImpl(node, DCTERMS.description, descLiteral));
      }
      final String path = item.getPath();
      if (path != null) {
        Literal pathLiteral = LiteralFactory.getInstance().
View Full Code Here

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

      UriRef dtUriRef = new UriRef(datatypeString);
      return new TypedLiteralImpl(lexicalForm, dtUriRef);
    } else {
      String language = node.getLiteralLanguage();
      if ((language != null) && !language.equals("")) {
        return new PlainLiteralImpl(lexicalForm, new Language(language));
      } else {
        return new PlainLiteralImpl(lexicalForm);
      }
    }
  }
View Full Code Here

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

  @Test
  public void simpleSelectQuery() throws ParseException {
    SimpleMGraph data = new SimpleMGraph();
    final String titleValue = "SPARQL Tutorial";
    data.add(new TripleImpl(new UriRef("http://example.org/book/book1"),
        DC.title, new PlainLiteralImpl(titleValue)));
    String query = "SELECT ?title WHERE" +
        "{" +
        "  <http://example.org/book/book1> <"+DC.title.getUnicodeString()+"> ?title ." +
        "}";
    ResultSet resultSet = (ResultSet) TcManager.getInstance().executeSparqlQuery(
View Full Code Here

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

  @Test
  public void simpleAskQuery() throws ParseException {
    SimpleMGraph data = new SimpleMGraph();
    final String titleValue = "SPARQL Tutorial";
    data.add(new TripleImpl(new UriRef("http://example.org/book/book1"),
        DC.title, new PlainLiteralImpl(titleValue)));
    String query = "ASK WHERE" +
        "{" +
        "  <http://example.org/book/book1> <"+DC.title.getUnicodeString()+"> ?title ." +
        "}";
    Assert.assertEquals(Boolean.TRUE,
View Full Code Here

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

  @Test
  public void simpleDescribe() throws ParseException {
    SimpleMGraph data = new SimpleMGraph();
    final String titleValue = "SPARQL Tutorial";
    data.add(new TripleImpl(new UriRef("http://example.org/book/book1"),
        DC.title, new PlainLiteralImpl(titleValue)));
    String query = "DESCRIBE "+
        "  <http://example.org/book/book1>";
    Assert.assertEquals(1,
        ((Graph)TcManager.getInstance().executeSparqlQuery(
        QueryParser.getInstance().parse(query), data)).size());
View Full Code Here

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

  @Test
  public void simpleConstruct() throws ParseException {
    SimpleMGraph data = new SimpleMGraph();
    final String titleValue = "SPARQL Tutorial";
    data.add(new TripleImpl(new UriRef("http://example.org/book/book1"),
        DC.title, new PlainLiteralImpl(titleValue)));
    String query = "PREFIX foaf:   <http://xmlns.com/foaf/0.1/> " +
        "CONSTRUCT { <http://foo/bar> foaf:name ?title } WHERE" +
        "{" +
        "  <http://example.org/book/book1> <"+DC.title.getUnicodeString()+"> ?title ." +
        "}";
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.