Package de.fuberlin.wiwiss.d2rq.map

Examples of de.fuberlin.wiwiss.d2rq.map.DownloadMap


  public void testGenerateDownloadMap() {
    Mapping m = MappingHelper.readFromTestFile("parser/download-map.ttl");
    MappingHelper.connectToDummyDBs(m);
    Resource name = ResourceFactory.createResource("http://example.org/dm");
    assertTrue(m.downloadMapResources().contains(name));
    DownloadMap d = m.downloadMap(name);
    assertNotNull(d);
    assertEquals("image/png",
        d.getMediaTypeValueMaker().makeValue(
            new ResultRow() {public String get(ProjectionSpec column) {return null;}}));
    assertEquals("People.pic", d.getContentDownloadColumn().qualifiedName());
    assertEquals("URI(Pattern(http://example.org/downloads/@@People.ID@@))",
        d.nodeMaker().toString());
    assertEquals(
        new HashSet<ProjectionSpec>() {{
          add(SQL.parseAttribute("People.ID"));
          add(SQL.parseAttribute("People.pic"));
        }},
        d.getRelation().projections());
    assertTrue(d.getRelation().isUnique());
    assertTrue(d.getRelation().condition().isTrue());
    assertTrue(d.getRelation().joinConditions().isEmpty());
  }
View Full Code Here


  private void parseDownloadMaps() {
    Iterator<Individual> it = this.model.listIndividuals(D2RQ.DownloadMap);
    while (it.hasNext()) {
      Resource downloadMapResource = it.next();
      DownloadMap downloadMap = new DownloadMap(downloadMapResource);
      parseResourceMap(downloadMap, downloadMapResource);
      parseDownloadMap(downloadMap, downloadMapResource);
      mapping.addDownloadMap(downloadMap);
    }
  }
View Full Code Here

  }

  private boolean handleDownload(String resourceURI, HttpServletResponse response, D2RServer server) throws IOException {
    Mapping m = D2RServer.retrieveSystemLoader(getServletContext()).getMapping();
    for (Resource r: m.downloadMapResources()) {
      DownloadMap d = m.downloadMap(r);
      DownloadContentQuery q = new DownloadContentQuery(d, resourceURI);
      if (q.hasContent()) {
        response.setContentType(q.getMediaType() != null ? q.getMediaType() : "application/octet-stream");
        InputStream is = q.getContentStream();
        OutputStream os = response.getOutputStream();
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.d2rq.map.DownloadMap

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.