001package conexp.fx.gui.dataset; 002 003/* 004 * #%L 005 * Concept Explorer FX 006 * %% 007 * Copyright (C) 2010 - 2019 Francesco Kriegel 008 * %% 009 * This program is free software: you can redistribute it and/or modify 010 * it under the terms of the GNU General Public License as 011 * published by the Free Software Foundation, either version 3 of the 012 * License, or (at your option) any later version. 013 * 014 * This program is distributed in the hope that it will be useful, 015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 017 * GNU General Public License for more details. 018 * 019 * You should have received a copy of the GNU General Public 020 * License along with this program. If not, see 021 * <http://www.gnu.org/licenses/gpl-3.0.html>. 022 * #L% 023 */ 024 025import java.util.Set; 026 027import org.semanticweb.owlapi.model.IRI; 028 029import conexp.fx.core.collections.Pair; 030import conexp.fx.core.dl.deprecated.OWLInterpretation; 031import conexp.fx.core.util.IdGenerator; 032import conexp.fx.gui.ConExpFX; 033import conexp.fx.gui.assistent.InducedContextAssistent; 034import javafx.scene.control.ChoiceBox; 035import javafx.scene.control.Label; 036import javafx.scene.control.ListView; 037import javafx.scene.layout.BorderPane; 038import javafx.scene.layout.HBox; 039 040public class DLDataset extends Dataset { 041 042 public class DomainWidget { 043 044 private final BorderPane contentPane; 045 046 public DomainWidget() { 047 super(); 048 this.contentPane = new BorderPane(); 049 final ListView<IRI> listView = new ListView<IRI>(); 050 listView.getItems().addAll(interpretation.getDomain()); 051 contentPane.setCenter(listView); 052 } 053 054 } 055 056 public class ConceptWidget { 057 058 private final BorderPane contentPane; 059 060 public ConceptWidget() { 061 super(); 062 this.contentPane = new BorderPane(); 063 final Label conceptLabel = new Label("Concept Name"); 064 final ChoiceBox<IRI> conceptChoiceBox = new ChoiceBox<IRI>(); 065 conceptChoiceBox.getItems().addAll(interpretation.getSignature().getConceptNames()); 066 final ListView<IRI> listView = new ListView<IRI>(); 067 conceptChoiceBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { 068 listView.getItems().clear(); 069 listView.getItems().addAll(interpretation.getConceptNameExtension(newValue)); 070 }); 071 contentPane.setTop(new HBox(conceptLabel, conceptChoiceBox)); 072 contentPane.setCenter(listView); 073 conceptChoiceBox.getSelectionModel().selectFirst(); 074 } 075 } 076 077 public class RoleWidget { 078 079 private final BorderPane contentPane; 080 081 public RoleWidget() { 082 super(); 083 this.contentPane = new BorderPane(); 084 final Label roleLabel = new Label("Role Name"); 085 final ChoiceBox<IRI> roleChoiceBox = new ChoiceBox<IRI>(); 086 roleChoiceBox.getItems().addAll(interpretation.getSignature().getRoleNames()); 087 final ListView<Pair<IRI, IRI>> listView = new ListView<Pair<IRI, IRI>>(); 088 roleChoiceBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { 089 listView.getItems().clear(); 090 listView.getItems().addAll(interpretation.getRoleNameExtension(newValue)); 091 }); 092 contentPane.setTop(new HBox(roleLabel, roleChoiceBox)); 093 contentPane.setCenter(listView); 094 roleChoiceBox.getSelectionModel().selectFirst(); 095 } 096 } 097 098 public final OWLInterpretation interpretation; 099 100 public DLDataset(final Dataset parent, final OWLInterpretation interpretation) { 101 super(parent); 102 this.interpretation = interpretation; 103 this.id.set("Model " + IdGenerator.getNextId(ConExpFX.instance)); 104 this.views 105 .add(new DatasetView<Set<IRI>>("Individuals", new DomainWidget().contentPane, interpretation.getDomain())); 106 this.views.add( 107 new DatasetView<Set<IRI>>( 108 "Concept Names", 109 new ConceptWidget().contentPane, 110 interpretation.getSignature().getConceptNames())); 111 this.views.add( 112 new DatasetView<Set<IRI>>( 113 "Role Names", 114 new RoleWidget().contentPane, 115 interpretation.getSignature().getRoleNames())); 116 this.defaultActiveViews.add("Individuals"); 117 this.actions 118 .add(new DatasetAction("New Induced Context...", () -> new InducedContextAssistent(this).showAndWait())); 119 } 120 121 @Override 122 public void save() { 123 // TODO Auto-generated method stub 124 125 } 126 127 @Override 128 public void saveAs() { 129 // TODO Auto-generated method stub 130 131 } 132 133 @Override 134 public void export() { 135 // TODO Auto-generated method stub 136 137 } 138 139 @Override 140 public void close() { 141 // TODO Auto-generated method stub 142 143 } 144 145}