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.core.owl;
020
021import java.util.HashMap;
022import java.util.Map;
023import java.util.SortedSet;
024import java.util.TreeSet;
025
026/**
027 * A flat ABox can be used to store knowledge of a completely dematerialised knowledge base.
028 * 
029 * @author Jens Lehmann
030 *
031 */
032public class FlatABox {
033    
034    public SortedSet<String> roles = new TreeSet<>();
035    public SortedSet<String> concepts = new TreeSet<>();
036    public SortedSet<String> domain = new TreeSet<>();
037    public SortedSet<String> top = new TreeSet<>();
038    public SortedSet<String> bottom = new TreeSet<>();
039    
040    public Map<String,SortedSet<String>> atomicConceptsPos = new HashMap<>();
041    public Map<String,SortedSet<String>> atomicConceptsNeg = new HashMap<>();
042    public Map<String,Map<String,SortedSet<String>>> rolesPos = new HashMap<>();
043    public Map<String,Map<String,SortedSet<String>>> rolesNeg = new HashMap<>();
044    
045    public Map<String,SortedSet<String>> exampleConceptsPos = new HashMap<>();
046    public Map<String,SortedSet<String>> exampleConceptsNeg = new HashMap<>();
047    
048    public FlatABox() {
049        
050    }
051    
052    public SortedSet<String> getPositiveInstances(String conceptName) {
053        return atomicConceptsPos.get(conceptName);
054    }
055    
056    public SortedSet<String> getNegativeInstances(String conceptName) {
057        return atomicConceptsPos.get(conceptName);
058    }
059    
060        @Override           
061    public String toString() {
062        String output = "";
063        output += "domain: " + domain.toString() + "\n";
064        output += "top: " + top.toString() + "\n";
065        output += "bottom: " + bottom.toString() + "\n";
066        output += "concept pos: " + atomicConceptsPos.toString() + "\n";    
067        output += "concept neg: " + atomicConceptsNeg.toString() + "\n";       
068        output += "role pos: " + rolesPos.toString() + "\n";    
069        output += "role neg: " + rolesNeg.toString() + "\n"; 
070        output += "positive examples: " + exampleConceptsPos.toString() + "\n";
071        output += "negative examples: " + exampleConceptsNeg.toString() + "\n";
072        return output;
073    }
074    
075    public String getTargetConcept() {
076        return (String) exampleConceptsPos.keySet().toArray()[0];
077    }
078    
079//    public void createExampleABox() {
080//        domain = new TreeSet<String>();
081//        domain.add("stefan");
082//        domain.add("markus");
083//        
084//        top = domain;
085//        bottom = new TreeSet<String>();
086//        
087//        atomicConceptsPos = new HashMap<String,Set<String>>();
088//        Set<String> male = new TreeSet<String>();
089//        male.add("stefan");
090//        male.add("markus");
091//        atomicConceptsPos.put("male",male);
092//        
093//        atomicConceptsNeg = new HashMap<String,Set<String>>();
094//        Set<String> maleNeg = new TreeSet<String>();  
095//        atomicConceptsNeg.put("male",maleNeg);
096//        
097//        rolesPos = new HashMap<String,Map<String,Set<String>>>();
098//        Map<String,Set<String>> hasChild = new HashMap<String,Set<String>>();
099//        Set<String> childsStefan = new TreeSet<String>();
100//        childsStefan.add("markus");
101//        hasChild.put("stefan",childsStefan);
102//        Set<String> childsMarkus = new TreeSet<String>();
103//        hasChild.put("markus", childsMarkus);
104//        rolesPos.put("hasChild", hasChild);
105//        
106//        rolesNeg = new HashMap<String,Map<String,Set<String>>>();
107//        Map<String,Set<String>> hasChildNeg = new HashMap<String,Set<String>>();
108//        Set<String> childsStefanNeg = new TreeSet<String>();
109//        hasChildNeg.put("stefan",childsStefanNeg);
110//        Set<String> childsMarkusNeg = new TreeSet<String>();
111//        hasChildNeg.put("markus", childsMarkusNeg);
112//        rolesNeg.put("hasChild", hasChildNeg);
113//    }
114    
115    
116}