Package org.apache.clerezza.rdf.utils

Examples of org.apache.clerezza.rdf.utils.GraphNode


    this.renderingSpecification = renderingSpecification;
  }

  @Override
  public GraphNode getExceptionGraphNode() {
    GraphNode result = new GraphNode(new BNode(), new SimpleMGraph());
    result.addProperty(RDF.type, TYPERENDERING.Exception);
    result.addProperty(TYPERENDERING.errorSource, new UriRef(renderingSpecification.toString()));
    result.addProperty(TYPERENDERING.message, new PlainLiteralImpl(getMessage()));
    result.addProperty(TYPERENDERING.stackTrace, getStackTraceLiteral());
    return result;
  }
View Full Code Here


  public UriRef getDefaultBaseUri() {
    return AccessController.doPrivileged(new PrivilegedAction<UriRef>() {

      @Override
      public UriRef run() {
        GraphNode platformInstance = getPlatformInstance();
        Lock l = platformInstance.readLock();
        l.lock();
        try {
          Iterator<Resource> triples = platformInstance.getObjects(PLATFORM.defaultBaseUri);
          if (triples.hasNext()) {
            return (UriRef) triples.next();
          } else {
            String port = context.getProperty("org.osgi.service.http.port");
            if (port == null) {
View Full Code Here

   * instance underlying the <code>GraphNode</code>.
   *
   * @return
   */
  public GraphNode getPlatformInstance() {
    return new GraphNode(getPlatformInstanceResource(), systemGraph);
  }
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

          }
          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);
          List<MediaType> acceptableMediaTypes =
          Collections.singletonList(MediaType.TEXT_PLAIN_TYPE);
          mailMan.sendEmailToUser(passwordUser, userName, "New Password",
          mailGraph, acceptableMediaTypes, null);
        } catch (MessagingException ex) {
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 class DefaultCASMappingStrategy implements CASMappingStrategy {

  @Override
  public void map(CAS cas, String graphName) throws CASMappingException {
    try {
      GraphNode node = createNode(graphName);
      UIMAUtils.enhanceNode(node, UIMAUtils.getAllFSofType(TOP.type, cas.getJCas()));
    } catch (Exception e) {
      throw new CASMappingException(e);
    }
  }
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

    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());
    Assert.assertEquals(Double.toString(london.toString().length()),
        node.getObjectNodes(CityWeatherEnricher.weatherProperty).next()
        .getLiterals(CityWeatherEnricher.temperatureProperty).next().getLexicalForm());
  }
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.utils.GraphNode

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.