Package edu.mit.simile.fresnel.configuration

Examples of edu.mit.simile.fresnel.configuration.Configuration


    PrintWriter writer = new PrintWriter(new OutputStreamWriter(response.getOutputStream() , "UTF-8"));
    String errorString = null;
    Selection selected = null;
    List<org.apache.commons.httpclient.URI> retrievedURLs = null;
    Resource focalResource = null;
    Configuration conf = null;
    String redirectLocation = null;
   
    try {
      /* Reload the Fresnel configuration using the provided language */
      String langPref = (request.getParameter("lang") != null ? request.getParameter("lang") : "en");
      loadFresnelConfig(langPref);

      conf = new Configuration(confRepository, ontoRepository);
     
      /* Create the focal resource */
      if (request.getParameter("uri") != null) {
        String uriString = request.getParameter("uri");
        if (uriString.startsWith("_:")) /* blank node */
          focalResource = valueFactory.createBNode(uriString.substring(2));
        else
          focalResource = valueFactory.createURI(uriString);
         
        /* Collect data about the focal resource */
        if (request.getParameter("skipload") == null) {
          retrievedURLs = semwebClient.discoverResource(focalResource, true /* wait */);   
        } /* skip */
       
        /* Initiate manual owl:sameAs inference */
        if (request.getParameter("skipInference") == null) {
          sameAsInferencer.addInferredForResource(focalResource);
        }
     
        if (conf.hasWarnings())
          writer.println(conf.getWarningsString());
       
        Purpose purpose = null;
       
        /* Look up the requested lens purpose */
        if (request.getParameter("purpose") != null && (!request.getParameter("purpose").equals("defaultPurpose")))
          purpose = new Purpose(new URIImpl(Constants.nsFresnelExt + request.getParameter("purpose")));
        else
          purpose = new Purpose(new URIImpl("http://www.w3.org/2004/09/fresnel#defaultLens")); /* this must be provided, or a random lens is chosen */

        try {
          /* Perform Fresnel selection using the requested display purpose and language */
          selected = conf.select(dataRepository, focalResource, purpose, langPref);
   
          /* Perform Fresnel formatting */
          selected = conf.format(dataRepository, selected);
        }
        catch (NoResultsException e) {
         
              /*
               * If no results are found, redirect the user to the resource
View Full Code Here


   
    try {
      FresnelUtilities.read(confRepo, "file:///" + config.getAbsolutePath(), "TURTLE");
      FresnelUtilities.read(dataRepo, "file:///" + data.getAbsolutePath(), "RDFXML");
      FresnelUtilities.read(ontoRepo, "file:///" + onto.getAbsolutePath(), "RDFXML");
      conf = new Configuration(confRepo, ontoRepo);
    } catch (Exception e) {
      assertTrue(false);
      logger.error(e.getMessage());
    }
  }
View Full Code Here

      System.err.println("Problems reading input data: " + e.toString());
      e.printStackTrace();
    }
   
    try {
      Configuration conf = new Configuration(confRepo, ontoRepo);
      if (conf.hasWarnings()) System.err.println(conf.getWarningsString());
      Selection selected = conf.select(dataRepo);
      selected = conf.format(dataRepo, selected);
      Document out = selected.render();
      if (opts.isDebug()) {
        System.out.println(conf);
      } else {
        DOMSource in = new DOMSource(out);
View Full Code Here

TOP

Related Classes of edu.mit.simile.fresnel.configuration.Configuration

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.