001/** 002 * Copyright (C) 2007 - 2016, Jens Lehmann 003 * 004 * This file is part of DL-Learner. 005 * 006 * DL-Learner is free software; you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation; either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * DL-Learner is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package org.dllearner.kb.manipulator; 020 021import java.util.HashMap; 022import java.util.Map; 023import java.util.SortedSet; 024 025import org.dllearner.kb.extraction.Node; 026import org.dllearner.utilities.datastructures.RDFNodeTuple; 027import org.dllearner.utilities.owl.OWLVocabulary; 028 029import org.apache.jena.rdf.model.impl.ResourceImpl; 030 031public class DBPediaNavigatorCityLocatorRule extends Rule{ 032 033 Map<String,String> map= new HashMap<>(); 034 035 public DBPediaNavigatorCityLocatorRule(Months month){ 036 super(month); 037 map.put("http://dbpedia.org/class/custom/City_in_Saxony", "http://dbpedia.org/class/custom/City_in_Europe"); 038 map.put("http://dbpedia.org/class/custom/City_in_Egypt", "http://dbpedia.org/class/custom/City_in_Africa"); 039 map.put("http://dbpedia.org/class/custom/City_in_Europe", "http://dbpedia.org/class/yago/City108524735"); 040 map.put("http://dbpedia.org/class/custom/City_in_Asia", "http://dbpedia.org/class/yago/City108524735"); 041 map.put("http://dbpedia.org/class/custom/City_in_Australia", "http://dbpedia.org/class/yago/City108524735"); 042 map.put("http://dbpedia.org/class/custom/City_in_North_America", "http://dbpedia.org/class/yago/City108524735"); 043 map.put("http://dbpedia.org/class/custom/City_in_South_America", "http://dbpedia.org/class/yago/City108524735"); 044 map.put("http://dbpedia.org/class/custom/City_in_Africa", "http://dbpedia.org/class/yago/City108524735"); 045 map.put("http://dbpedia.org/class/custom/City_in_World", "http://dbpedia.org/class/yago/City108524735"); 046 } 047 048 049 050 @Override 051 public SortedSet<RDFNodeTuple> applyRule(Node subject, SortedSet<RDFNodeTuple> tuples){ 052 053 String uri; 054 if(( uri = map.get(subject.getURIString()) ) == null) { 055 return tuples; 056 }else { 057 tuples.add(new RDFNodeTuple(new ResourceImpl(OWLVocabulary.RDFS_SUBCLASS_OF), new ResourceImpl(uri))); 058 return tuples; 059 } 060 061 062 } 063 064 @Override 065 public void logJamon(){ 066 067 } 068 069 070 071 072 073}