Exemplo n.º 1
0
 @BeforeClass
 public static void setUpServices() throws IOException {
   openNLP = new OpenNLP(new ClasspathDataFileProvider("DUMMY_SYMBOLIC_NAME"));
   searcher = new TestSearcherImpl(NAME, SimpleTokenizer.INSTANCE);
   // add some terms to the searcher
   Representation rep = factory.createRepresentation("urn:test:PatrickMarshall");
   rep.addNaturalText(NAME, "Patrick Marshall");
   rep.addReference(TYPE, OntologicalClasses.DBPEDIA_PERSON.getUnicodeString());
   searcher.addEntity(rep);
   rep = factory.createRepresentation("urn:test:Geologist");
   rep.addNaturalText(NAME, "Geologist");
   rep.addReference(TYPE, NamespaceEnum.skos + "Concept");
   rep.addReference(REDIRECT, "urn:test:redirect:Geologist");
   searcher.addEntity(rep);
   // a redirect
   rep = factory.createRepresentation("urn:test:redirect:Geologist");
   rep.addNaturalText(NAME, "Geologe (redirect)");
   rep.addReference(TYPE, NamespaceEnum.skos + "Concept");
   searcher.addEntity(rep);
   rep = factory.createRepresentation("urn:test:NewZealand");
   rep.addNaturalText(NAME, "New Zealand");
   rep.addReference(TYPE, OntologicalClasses.DBPEDIA_PLACE.getUnicodeString());
   searcher.addEntity(rep);
   rep = factory.createRepresentation("urn:test:UniversityOfOtago");
   rep.addNaturalText(NAME, "University of Otago");
   rep.addReference(TYPE, OntologicalClasses.DBPEDIA_ORGANISATION.getUnicodeString());
   searcher.addEntity(rep);
   rep = factory.createRepresentation("urn:test:University");
   rep.addNaturalText(NAME, "University");
   rep.addReference(TYPE, NamespaceEnum.skos + "Concept");
   searcher.addEntity(rep);
   rep = factory.createRepresentation("urn:test:Otago");
   rep.addNaturalText(NAME, "Otago");
   rep.addReference(TYPE, OntologicalClasses.DBPEDIA_PLACE.getUnicodeString());
   searcher.addEntity(rep);
   // add a 2nd Otago (Place and University
   rep = factory.createRepresentation("urn:test:Otago_Texas");
   rep.addNaturalText(NAME, "Otago (Texas)");
   rep.addNaturalText(NAME, "Otago");
   rep.addReference(TYPE, OntologicalClasses.DBPEDIA_PLACE.getUnicodeString());
   searcher.addEntity(rep);
   rep = factory.createRepresentation("urn:test:UniversityOfOtago_Texas");
   rep.addNaturalText(NAME, "University of Otago (Texas)");
   rep.addReference(TYPE, OntologicalClasses.DBPEDIA_ORGANISATION.getUnicodeString());
   searcher.addEntity(rep);
 }
Exemplo n.º 2
0
  static { // the default mappings for the three types used by the Stanbol Enhancement Structure
    Map<String, UriRef> mappings = new HashMap<String, UriRef>();
    mappings.put(
        OntologicalClasses.DBPEDIA_ORGANISATION.getUnicodeString(),
        OntologicalClasses.DBPEDIA_ORGANISATION);
    mappings.put("http://dbpedia.org/ontology/Newspaper", OntologicalClasses.DBPEDIA_ORGANISATION);
    mappings.put("http://schema.org/Organization", OntologicalClasses.DBPEDIA_ORGANISATION);
    //
    // mappings.put(NamespaceEnum.dailymed+"organization",OntologicalClasses.DBPEDIA_ORGANISATION);

    mappings.put(
        OntologicalClasses.DBPEDIA_PERSON.getUnicodeString(), OntologicalClasses.DBPEDIA_PERSON);
    mappings.put("http://xmlns.com/foaf/0.1/Person", OntologicalClasses.DBPEDIA_PERSON);
    mappings.put("http://schema.org/Person", OntologicalClasses.DBPEDIA_PERSON);

    mappings.put(
        OntologicalClasses.DBPEDIA_PLACE.getUnicodeString(), OntologicalClasses.DBPEDIA_PLACE);
    mappings.put("http://schema.org/Place", OntologicalClasses.DBPEDIA_PLACE);
    mappings.put("http://www.opengis.net/gml/_Feature", OntologicalClasses.DBPEDIA_PLACE);

    mappings.put(
        OntologicalClasses.SKOS_CONCEPT.getUnicodeString(), OntologicalClasses.SKOS_CONCEPT);

    mappings.put(
        OntologicalClasses.DBPEDIA_ORGANISATION.getUnicodeString(),
        OntologicalClasses.DBPEDIA_ORGANISATION);
    //        UriRef DRUG = new UriRef(NamespaceEnum.drugbank+"drugs");
    //        mappings.put(DRUG.getUnicodeString(), DRUG);
    //        mappings.put(NamespaceEnum.dbpediaOnt+"Drug", DRUG);
    //        mappings.put(NamespaceEnum.dailymed+"drugs", DRUG);
    //        mappings.put(NamespaceEnum.sider+"drugs", DRUG);
    //        mappings.put(NamespaceEnum.tcm+"Medicine", DRUG);
    //
    //        UriRef DISEASE = new UriRef(NamespaceEnum.diseasome+"diseases");
    //        mappings.put(DISEASE.getUnicodeString(), DISEASE);
    //        mappings.put(NamespaceEnum.linkedct+"condition", DISEASE);
    //        mappings.put(NamespaceEnum.tcm+"Disease", DISEASE);
    //
    //        UriRef SIDE_EFFECT = new UriRef(NamespaceEnum.sider+"side_effects");
    //        mappings.put(SIDE_EFFECT.getUnicodeString(), SIDE_EFFECT);
    //
    //        UriRef INGREDIENT = new UriRef(NamespaceEnum.dailymed+"ingredients");
    //        mappings.put(INGREDIENT.getUnicodeString(), INGREDIENT);

    DEFAULT_ENTITY_TYPE_MAPPINGS = Collections.unmodifiableMap(mappings);
  }