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

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


  }

  @Test
  public void testDeleteEntity() {
    TcProvider simpleTcmProvider = getInstance();
    MGraph mGraph = new SimpleMGraph();
    mGraph.add(new TripleImpl(uriRefA, uriRefA, uriRefA));
    Graph graph = mGraph.getGraph();
    simpleTcmProvider.createGraph(uriRefA, graph);
    simpleTcmProvider.createGraph(uriRefC, graph);

    simpleTcmProvider.deleteTripleCollection(uriRefA);
    try {
View Full Code Here


  }

  private TripleCollection createTestTripleCollection(Triple t) {
    Set<Triple> ts = new TreeSet<Triple>();
    ts.add(t);
    return new SimpleMGraph(ts);
  }
View Full Code Here

  }

  @GET
  public GraphNode resetPage(@Context UriInfo uriInfo) {
    TrailingSlash.enforcePresent(uriInfo);
    GraphNode result = new GraphNode(new BNode(), new SimpleMGraph());
    result.addProperty(RDF.type, USERMANAGER.PasswordResetPage);
    return result;
  }
View Full Code Here

                new PlainLiteralImpl(userName));
            agent = agents.next().getSubject();
          } finally {
            readLock.unlock();
          }
          MGraph temporary = new SimpleMGraph();
          temporary.add(new TripleImpl(agent, PERMISSION.password,
              new PlainLiteralImpl(newPassword)));
          MGraph result = new UnionMGraph(temporary, systemGraph);
          GraphNode mailGraph = new GraphNode(new BNode(), result);
          mailGraph.addProperty(RDF.type, USERMANAGER.PasswordResetMail);
          mailGraph.addProperty(USERMANAGER.recipient, agent);
View Full Code Here

  @Test
  public void testGenerateMethodWithUnsupportedMediaType() {
    try {
      UIMABaseMetadataGenerator baseMetadataGenerator = new UIMABaseMetadataGenerator();
      String textToAnalyze = TEXT_TO_ANALYZE;
      MGraph mGraph = new SimpleMGraph();
      GraphNode node = new GraphNode(new UriRef("test"), mGraph);
      MediaType wrongMediaType = MediaType.valueOf("multipart/form-data; boundary=AaB03x");
      baseMetadataGenerator.generate(node, textToAnalyze.getBytes(), wrongMediaType);
    } catch (Exception e) {
      fail(e.getLocalizedMessage());
View Full Code Here

      parameterSettings.put("apikey", "04490000a72fe7ec5cb3497f14e77f338c86f2fe");
      parameterSettings.put("licenseID", "g6h9zamsdtwhb93nc247ecrs");
      externalServicesFacade.setParameterSetting(parameterSettings);
      UIMABaseMetadataGenerator baseMetadataGenerator = new UIMABaseMetadataGenerator(externalServicesFacade);
      String textToAnalyze = TEXT_TO_ANALYZE;
      MGraph mGraph = new SimpleMGraph();
      GraphNode node = new GraphNode(new UriRef("test"), mGraph);
      baseMetadataGenerator.generate(node, textToAnalyze.getBytes(), MediaType.TEXT_PLAIN_TYPE);
    } catch (Exception e) {
      fail(e.getLocalizedMessage());
    }
View Full Code Here

*/
public class EnrichmentTriplesTest {

  @Test
  public void siblingAddition() {
    MGraph base = new SimpleMGraph();
    Enricher siblingEnricher = new SiblingEnricher();
    TripleCollection enrichmentTriples = new EnrichmentTriples(base,
        Collections.singleton(siblingEnricher));
    NonLiteral grandMother = new UriRef("http://example.org/grand");
    NonLiteral mother = new UriRef("http://example.org/mother");
    NonLiteral me = new UriRef("http://example.org/me");
    NonLiteral sister = new UriRef("http://example.org/sister");
    NonLiteral uncle = new UriRef("http://example.org/uncle");
    NonLiteral cousin = new UriRef("http://example.org/cousin");
    base.add(new TripleImpl(me, SiblingEnricher.parentProperty, mother));
    base.add(new TripleImpl(sister, SiblingEnricher.parentProperty, mother));
    base.add(new TripleImpl(mother, SiblingEnricher.parentProperty, grandMother));
    base.add(new TripleImpl(uncle, SiblingEnricher.parentProperty, grandMother));
    base.add(new TripleImpl(cousin, SiblingEnricher.parentProperty, uncle));
    Assert.assertTrue(enrichmentTriples.filter(sister, SiblingEnricher.siblingProperty, me).hasNext());
    Assert.assertTrue(enrichmentTriples.filter(uncle, SiblingEnricher.siblingProperty, mother).hasNext());
    Assert.assertFalse(enrichmentTriples.filter(uncle, SiblingEnricher.siblingProperty, sister).hasNext());
  }
View Full Code Here

    Assert.assertFalse(enrichmentTriples.filter(uncle, SiblingEnricher.siblingProperty, sister).hasNext());
  }

  @Test
  public void cityWeather() {
    MGraph base = new SimpleMGraph();
    Enricher cityEnricher = new CityWeatherEnricher();
    TripleCollection enrichmentTriples = new EnrichmentTriples(base,
        Collections.singleton(cityEnricher));
    NonLiteral london = new UriRef("http://example.org/london");
    NonLiteral me = new UriRef("http://example.org/me");
    base.add(new TripleImpl(me, RDF.type, FOAF.Agent));
    base.add(new TripleImpl(london, RDF.type, CityWeatherEnricher.classCity));
    Assert.assertTrue(enrichmentTriples.filter(london, CityWeatherEnricher.weatherProperty, null).hasNext());
    GraphNode node = new GraphNode(london, enrichmentTriples);
    Assert.assertEquals("0.51",
        node.getObjectNodes(CityWeatherEnricher.weatherProperty).next()
        .getLiterals(CityWeatherEnricher.humidityProperty).next().getLexicalForm());
View Full Code Here

  final static UriRef u1 = new UriRef("http://example.org/u1");

  @Test
  public void testEmpty() {
    TripleCollection tc1 = new SimpleMGraph();
    TripleCollection tc2 = new SimpleMGraph();
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNotNull(mapping);
    Assert.assertEquals(0, mapping.size());
  }
View Full Code Here

    Assert.assertEquals(0, mapping.size());
  }

  @Test
  public void test2() {
    TripleCollection tc1 = new SimpleMGraph();
    tc1.add(new TripleImpl(u1, u1, u1));
    TripleCollection tc2 = new SimpleMGraph();
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNull(mapping);
  }
View Full Code Here

TOP

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

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.