Package org.apache.clerezza.rdf.core

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


   */
  @Test
  public void testGetDescription() throws IOException {
   
    int port = createTestWebServer().getPort();
    UriRef uri = new UriRef("http://localhost:" + port + "/test");
   
    // Setup mGraph
    Triple triple = new TripleImpl(uri, RDF.type, myType);
    mGraph.add(triple);

    URL serverURL = new URL(uri.getUnicodeString() + "-description");
    HttpURLConnection connection = (HttpURLConnection) serverURL.openConnection();
   
    connection = (HttpURLConnection) serverURL.openConnection();
    connection.setRequestMethod("GET");

View Full Code Here


   * @param componentContext
   */
  protected void activate(ComponentContext componentContext) {
    URL templateURL = getClass().getResource("reset.xhtml");
    renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
        new UriRef(templateURL.toString()), USERMANAGER.PasswordResetPage,
        null, MediaType.APPLICATION_XHTML_XML_TYPE, true);

    templateURL = getClass().getResource("reset_mail.txt");
    renderletManager.registerRenderlet(SeedsnipeRenderlet.class.getName(),
        new UriRef(templateURL.toString()), USERMANAGER.PasswordResetMail,
        null, MediaType.TEXT_PLAIN_TYPE, true);
    passwordUser = (String)componentContext.getProperties().get(PASSWORD_USER);
    logger.info("Password Reset activated.");
  }
View Full Code Here

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

    }
  }

  private GraphNode createNode(String graphName) {
    final TcManager tcManager = TcManager.getInstance();
    final UriRef mGraphName = new UriRef(graphName);
    return new GraphNode(new BNode(), tcManager.createMGraph(mGraphName));
  }
View Full Code Here

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

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

  @Test
  public void test9() {
    NonLiteral crossing = new UriRef("http://example.org/");
    TripleCollection tc1 = generateCircle(2,crossing);
    tc1.addAll(generateCircle(3,crossing));
    TripleCollection tc2 = generateCircle(2,crossing);
    tc2.addAll(generateCircle(3,crossing));
    Assert.assertEquals(5, tc1.size());
View Full Code Here

 
  public UriRef get(int start, int end) {
    String key = start+":"+end;
    Selector sel = registry.get(key);
    if(sel==null) {
      UriRef uri= new UriRef(new StringBuilder(AO.Selector.getUnicodeString()).
                  append("/").append(count++).toString());
     
      sel=new Selector(uri,start,end);
      registry.put(key,sel);
    }
View Full Code Here

        }
        continue;
      }

      // Test if the given resource belongs to the ontology
      final UriRef classUri = (UriRef) classResource;
      final String strClassUri = classUri.getUnicodeString();
      if (strClassUri.startsWith(namespace)) {
        // The remaining part of the class URI must not contain
        // a slash '/' or a hash '#' character. Otherwise we assume
        // that is belongs to another ontology.
        final int offset = namespace.length();
View Full Code Here

TOP

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

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.