Package de.fuberlin.wiwiss.d2rq.map

Examples of de.fuberlin.wiwiss.d2rq.map.Mapping$AttributeTypeValidator


    this.model = ModelFactory.createDefaultModel();
  }

  public void testEmptyTranslationTable() {
    Resource r = addTranslationTableResource();
    Mapping mapping = new MapParser(this.model, null).parse();
    TranslationTable table = mapping.translationTable(r);
    assertNotNull(table);
    assertEquals(0, table.size());
  }
View Full Code Here


  }

  public void testGetSameTranslationTable() {
    Resource r = addTranslationTableResource();
    addTranslationResource(r, "foo", "bar");
    Mapping mapping = new MapParser(this.model, null).parse();
    TranslationTable table1 = mapping.translationTable(r);
    TranslationTable table2 = mapping.translationTable(r);
    assertSame(table1, table2);
  }
View Full Code Here

  }
 
  public void testParseTranslationTable() {
    Resource r = addTranslationTableResource();
    addTranslationResource(r, "foo", "bar");
    Mapping mapping = new MapParser(this.model, null).parse();
    TranslationTable table = mapping.translationTable(r);
    assertEquals(1, table.size());
    Translator translator = table.translator();
    assertEquals("bar", translator.toRDFValue("foo"));
  }
View Full Code Here

    Translator translator = table.translator();
    assertEquals("bar", translator.toRDFValue("foo"));
  }

  public void testParseAlias() {
    Mapping mapping = MappingHelper.readFromTestFile("parser/alias.ttl");
    MappingHelper.connectToDummyDBs(mapping);
    assertEquals(1, mapping.compiledPropertyBridges().size());
    TripleRelation bridge = (TripleRelation) mapping.compiledPropertyBridges().iterator().next();
    assertTrue(bridge.baseRelation().condition().isTrue());
    AliasMap aliases = bridge.baseRelation().aliases();
    AliasMap expected = new AliasMap(Collections.singleton(SQL.parseAlias("People AS Bosses")));
    assertEquals(expected, aliases);
  }
View Full Code Here

      assertEquals(D2RQException.MAPPING_LITERAL_INSTEADOF_RESOURCE, ex.errorCode());
    }
  }

  public void testTranslationTableRDFValueCanBeLiteral() {
    Mapping m = MappingHelper.readFromTestFile("parser/translation-table.ttl");
    TranslationTable tt = m.translationTable(ResourceFactory.createResource("http://example.org/tt"));
    assertEquals("http://example.org/foo", tt.translator().toRDFValue("literal"));
  }
View Full Code Here

    TranslationTable tt = m.translationTable(ResourceFactory.createResource("http://example.org/tt"));
    assertEquals("http://example.org/foo", tt.translator().toRDFValue("literal"));
  }
 
  public void testTranslationTableRDFValueCanBeURI() {
    Mapping m = MappingHelper.readFromTestFile("parser/translation-table.ttl");
    TranslationTable tt = m.translationTable(ResourceFactory.createResource("http://example.org/tt"));
    assertEquals("http://example.org/foo", tt.translator().toRDFValue("uri"));
  }
View Full Code Here

      assertEquals(D2RQException.MAPPING_TYPECONFLICT, ex.errorCode());
    }
  }
 
  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());
View Full Code Here

    // W3C Direct Mapping
    SystemLoader loader = new SystemLoader();
    loader.setJdbcURL("jdbc:hsqldb:mem:test");
    loader.setStartupSQLScript("doc/example/simple.sql");
    loader.setGenerateW3CDirectMapping(true);
    Mapping mapping = loader.getMapping();

    // Print some internal stuff that shows how D2RQ maps the
    // database to RDF triples
    for (TripleRelation internal: mapping.compiledPropertyBridges()) {
      System.out.println(internal);
    }

    // Write the contents of the virtual RDF model as N-Triples
    Model model = loader.getModelD2RQ();
View Full Code Here

  public void setUp() {
    db = new HSQLDatabase("test");
    db.executeSQL("CREATE TABLE People (ID INT NOT NULL PRIMARY KEY, PIC_CLOB CLOB NULL, PIC_BLOB BLOB NULL)");
    db.executeSQL("INSERT INTO People VALUES (1, 'Hello World!', NULL)");
    db.executeSQL("INSERT INTO People VALUES (2, NULL, HEXTORAW('404040'))");
    Mapping m = MappingHelper.readFromTestFile("download/download-map.ttl");
    downloadCLOB = m.downloadMap(ResourceFactory.createResource("http://example.org/downloadCLOB"));
    downloadBLOB = m.downloadMap(ResourceFactory.createResource("http://example.org/downloadBLOB"));
  }
View Full Code Here

    new VocabularySummarizer(D2RQ.class).assertNoUndefinedTerms(model,
        D2RQException.MAPPING_UNKNOWN_D2RQ_PROPERTY,
        D2RQException.MAPPING_UNKNOWN_D2RQ_CLASS);
    ensureAllDistinct(new Resource[]{D2RQ.Database, D2RQ.ClassMap, D2RQ.PropertyBridge,
        D2RQ.TranslationTable, D2RQ.Translation}, D2RQException.MAPPING_TYPECONFLICT);
    this.mapping = new Mapping();
    copyPrefixes();
    try {
      parseDatabases();
      parseConfiguration();
      parseTranslationTables();
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.d2rq.map.Mapping$AttributeTypeValidator

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.