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

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


      //getting the tBox here means no read right on Tbox is necessary
      //when smushing
      tBox = tcManager.getTriples(tBoxName);
    } catch (NoSuchEntityException e) {
      tBox = new SimpleMGraph();
      tBox.add(new TripleImpl(FOAF.mbox, RDF.type, OWL.InverseFunctionalProperty));
      tBox.add(new TripleImpl(FOAF.mbox_sha1sum, RDF.type, OWL.InverseFunctionalProperty));
      tBox.add(new TripleImpl(PLATFORM.userName, RDF.type, OWL.InverseFunctionalProperty));
      tBox = tcManager.createGraph(tBoxName, tBox);
    }
  }
View Full Code Here


    Assert.assertEquals(101, eventChunks.size());
    Assert.assertEquals(1, eventChunks.get(100).size());
  }

  private static Triple generateTriple() {
    return new TripleImpl(generateRandomUriRef(), generateRandomUriRef(),
        generateRandomUriRef());
  }
View Full Code Here

    public TestConceptProvider(List<UriRef> myConcepts,
        List<UriRef> yourConcepts, List<Integer> sameAs) {
      Assert.assertTrue(myConcepts.size()==4);
      Assert.assertTrue(yourConcepts.size()==4);
      for (UriRef concept : myConcepts) {
        conceptGraph.add(new TripleImpl(concept, RDF.type, SKOS.Concept));
      }
      for (Integer index : sameAs) {
        conceptGraph.add(new TripleImpl(myConcepts.get(index), OWL.sameAs,
          yourConcepts.get(index)));
      }
    }
View Full Code Here

 
  @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

    UriRef predicate = convertJenaUri2UriRef(triple.getPredicate());
    Resource object = convertJenaNode2Resource(triple.getObject());
    if (subject == null || object == null) {
      return null;
    }
    return new TripleImpl(subject, predicate, object);
  }
View Full Code Here

    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().
            createTypedLiteral(path);
        mGraph.add(new TripleImpl(node, GLOBALMENU.path, pathLiteral));
      }
      if (menu.children.size() > 0) {
        mGraph.add(new TripleImpl(node, GLOBALMENU.children,
            itemsAsRdfList(menu.children, mGraph)));
        mGraph.add(new TripleImpl(node, RDF.type, GLOBALMENU.Menu));
      } else {
        mGraph.add(new TripleImpl(node, RDF.type, GLOBALMENU.MenuItem));
      }
      list.add(node);
     
    }
    return result;
View Full Code Here

    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().
            createTypedLiteral(path);
        mGraph.add(new TripleImpl(node, GLOBALMENU.path, pathLiteral));
      }
      mGraph.add(new TripleImpl(node, RDF.type, GLOBALMENU.MenuItem));
      list.add(node);
    }
    return result;
  }
View Full Code Here

    MGraph subGraph = new SimpleMGraph();
    {
      BNode bNode1 = new BNode();
      BNode bNode2 = new BNode();
      subGraph.add(new TripleImpl(u1, u2, bNode2));
      subGraph.add(new TripleImpl(bNode2, u2, bNode2));
      subGraph.add(new TripleImpl(bNode2, u2, bNode1));
    }
    MGraphUtils.removeSubGraph(baseGraph, subGraph);
    Assert.assertEquals(1, baseGraph.size());
  }
View Full Code Here

  private MGraph createBaseGraph() {
    MGraph baseGraph = new SimpleMGraph();
    {
      BNode bNode1 = new BNode();
      BNode bNode2 = new BNode();
      baseGraph.add(new TripleImpl(u1, u2, bNode2));
      baseGraph.add(new TripleImpl(bNode2, u2, bNode2));
      baseGraph.add(new TripleImpl(bNode2, u2, bNode1));
      baseGraph.add(new TripleImpl(u3, u2, u1));
    }
    return baseGraph;
  }
View Full Code Here

  @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 ." +
        "}";
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.impl.TripleImpl

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.