001package conexp.fx.gui.assistent; 002 003/* 004 * #%L 005 * Concept Explorer FX 006 * %% 007 * Copyright (C) 2010 - 2023 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.Arrays; 026 027//import org.semanticweb.owlapi.model.IRI; 028//import org.semanticweb.owlapi.model.OWLClassExpression; 029 030import conexp.fx.core.builder.Request; 031import conexp.fx.core.builder.Requests.Source; 032import conexp.fx.core.builder.Requests.Type; 033import conexp.fx.core.context.Context; 034import conexp.fx.core.context.MatrixContext; 035//import conexp.fx.core.dl.deprecated.Constructor; 036import conexp.fx.gui.ConExpFX; 037//import conexp.fx.gui.assistent.InducedContextAssistent.Result; 038import conexp.fx.gui.dataset.DLDataset; 039import conexp.fx.gui.dataset.FCADataset; 040import conexp.fx.gui.task.TimeTask; 041import javafx.collections.FXCollections; 042import javafx.geometry.Insets; 043import javafx.scene.Node; 044import javafx.scene.control.Label; 045import javafx.scene.control.ListView; 046import javafx.scene.control.SelectionMode; 047import javafx.scene.layout.BorderPane; 048import javafx.scene.layout.HBox; 049import javafx.scene.layout.VBox; 050import jfxtras.scene.control.ListSpinner; 051 052@Deprecated 053public class InducedContextAssistent {} 054//public class InducedContextAssistent extends Assistent<Result> { 055// 056// public static class Result { 057// 058// public Integer selectedRoleDepth; 059// public Integer selectedMaxCardinality; 060// public Constructor[] selectedConstructors; 061// } 062// 063// private final DLDataset dataset; 064// private final ListSpinner<Integer> roleDepthSpinner = new ListSpinner<Integer>(0, 3); 065// private final ListSpinner<Integer> maxCardinalitySpinner = new ListSpinner<Integer>(1, 10); 066// private final ListView<Constructor> constructorListView = 067// new ListView<Constructor>(FXCollections.observableList(Arrays.asList(Constructor.values()))); 068// 069// public InducedContextAssistent(DLDataset dataset) { 070// super( 071// ConExpFX.instance.primaryStage, 072// "Induced Context Wizard", 073// "Description Logic", 074// "Select Description Logic Constructors", 075// null, 076// r -> null); 077// this.dataset = dataset; 078// initialize(); 079// this.resultProperty.set(new Result()); 080//// this.resultProperty.bind(new ObjectBinding<Result>() { 081//// 082//// { 083//// super.bind( 084//// roleDepthSpinner.valueProperty(), 085//// maxCardinalitySpinner.valueProperty(), 086//// constructorListView.getSelectionModel().getSelectedItems()); 087//// } 088//// 089//// @Override 090//// protected Result computeValue() { 091//// final Result result = new Result(); 092//// result.selectedConceptNames = conceptListView.getSelectionModel().getSelectedItems(); 093//// result.selectedRoleNames = roleListView.getSelectionModel().getSelectedItems(); 094//// result.selectedIsARoleName = isaRoleChoiceBox.getSelectionModel().getSelectedItem(); 095//// result.selectedRoleDepth = roleDepthSpinner.getValue(); 096//// result.selectedMaxCardinality = maxCardinalitySpinner.getValue(); 097//// result.selectedConstructors = constructorListView.getSelectionModel().getSelectedItems().toArray( 098//// new Constructor[] {}); 099//// return result; 100//// } 101//// }); 102// } 103// 104// @Override 105// protected Node createInitialNode() { 106// final BorderPane pane = new BorderPane(); 107// pane.setPadding(new Insets(4)); 108// roleDepthSpinner.setValue(1); 109// maxCardinalitySpinner.setValue(3); 110// final Label roleDepthLabel = new Label("Role Depth"); 111// roleDepthLabel.setPadding(new Insets(4)); 112// final Label maxCardinalityLabel = new Label("Maximal Cardinality in Number Restrictions"); 113// maxCardinalityLabel.setPadding(new Insets(4)); 114// final Label constructorLabel = new Label("Constructors"); 115// constructorLabel.setPadding(new Insets(4, 4, 1, 4)); 116// roleDepthLabel.setMinWidth(100); 117// maxCardinalityLabel.setMinWidth(100); 118// roleDepthLabel.minWidthProperty().bind(maxCardinalityLabel.widthProperty()); 119// final HBox rbox = new HBox(roleDepthLabel, roleDepthSpinner); 120// final HBox cbox = new HBox(maxCardinalityLabel, maxCardinalitySpinner); 121// final VBox vbox = new VBox(rbox, cbox, constructorLabel, constructorListView); 122// pane.setCenter(vbox); 123// constructorListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); 124// constructorListView.getSelectionModel().select(Constructor.CONJUNCTION); 125// constructorListView.getSelectionModel().select(Constructor.EXISTENTIAL_RESTRICTION); 126// return pane; 127// } 128// 129// @Override 130// protected void createPages() {} 131// 132// @Override 133// protected void onNext() { 134// this.resultProperty.get().selectedRoleDepth = roleDepthSpinner.getValue(); 135// this.resultProperty.get().selectedMaxCardinality = maxCardinalitySpinner.getValue(); 136// this.resultProperty.get().selectedConstructors = 137// constructorListView.getSelectionModel().getSelectedItems().toArray(new Constructor[] {}); 138// ConExpFX.instance.executor.execute(new TimeTask<Void>("Creating new Induced Context") { 139// 140// @Override 141// protected Void call() { 142// updateProgress(0d, 1d); 143// if (isCancelled()) 144// return null; 145// final Context<IRI, OWLClassExpression> inducedContext = dataset.interpretation.getInducedContext( 146// dataset.interpretation.getDomain(), 147// resultProperty.get().selectedRoleDepth, 148// resultProperty.get().selectedMaxCardinality, 149// resultProperty.get().selectedConstructors); 150// ConExpFX.instance.treeView.addDataset( 151// new FCADataset<IRI, OWLClassExpression>( 152// dataset, 153// new Request<IRI, OWLClassExpression>(Type.INDUCED_CONTEXT, Source.NULL) { 154// 155// @Override 156// public MatrixContext<IRI, OWLClassExpression> createContext() { 157// MatrixContext<IRI, OWLClassExpression> cxt = new MatrixContext<IRI, OWLClassExpression>(false); 158// return cxt; 159// } 160// 161// @Override 162// public void setContent() { 163// this.context.rowHeads().addAll(inducedContext.rowHeads()); 164// this.context.colHeads().addAll(inducedContext.colHeads()); 165// context.addAll(inducedContext); 166// } 167// })); 168// updateProgress(1d, 1d); 169// return null; 170// } 171// }); 172// } 173// 174//}