private void AddButton_OnClick(object sender, RoutedEventArgs e) { if (!InputChecker.isValidInput(SubjectMainClass.Text)) { MessageBox.Show("Invalid input", "Error"); return; } if (dm.graph.GetTriplesWithSubjectPredicate(dm.graph.CreateUriNode("mc:" + SubjectMainClass.Text), dm.graph.CreateUriNode("rdfs:subClassOf")).Any() || dm.graph.GetTriplesWithSubjectObject(dm.graph.CreateUriNode("mc:" + SubjectMainClass.Text), dm.graph.CreateUriNode("rdfs:Class")).Any()) { MessageBox.Show("Class " + SubjectMainClass.Text + " already exists", "Error"); return; } dm.AddTriple("mc:" + SubjectMainClass.Text, "rdf:type", "rdfs:Class"); MessageBox.Show("Success!", "Triple asserted!"); InitItemsSources(); }
private void AddIndividButton_OnClick(object sender, RoutedEventArgs e) { if (!InputChecker.isValidInput(SubjectIndivid.Text, ObjectClass.Text)) { MessageBox.Show("Invalid input", "Error"); return; } if (dm.objects.Contains(SubjectIndivid.Text)) { MessageBox.Show("This object already exists", "Error"); return; } dm.AddTriple("mo:" + SubjectIndivid.Text, "rdf:type", "mc:" + ObjectClass.Text); MessageBox.Show("Success!", "Triple asserted!"); InitItemsSources(); }
private void AddPropertyButton_OnClick(object sender, RoutedEventArgs e) { if (!InputChecker.isValidInput(PropertySubject.Text)) { MessageBox.Show("Invalid input", "Error"); return; } if (dm.properties.Contains(PropertySubject.Text)) { MessageBox.Show("This property already exists", "Error"); return; } dm.properties.Add(PropertySubject.Text); dm.AddTriple("mp:" + PropertySubject.Text, "rdf:type", "rdf:Property"); MessageBox.Show("Success!", "Triple asserted!"); InitItemsSources(); }
private void AddPropTripleButton_OnClick(object sender, RoutedEventArgs e) { if (!InputChecker.isValidInput(PropTripleSubject.Text, PropTripleObject.Text, PropTriplePredicate.Text)) { MessageBox.Show("Invalid input", "Error"); return; } if (PropTripleSubject.Text == PropTripleObject.Text) { MessageBox.Show("You can not add triple with equal Subject and Object", "Error"); return; } if (dm.Triples.Contains(new Tuple <string, string, string>("Object:" + PropTripleSubject.Text, PropTriplePredicate.Text, "Object:" + PropTripleObject.Text))) { MessageBox.Show("This triple already exists", "Error"); return; } if (PropTriplePredicate.Text == "whatFor") { dm.AddTriple("mo:" + PropTripleSubject.Text, "wikiProperty:P1542", "mo:" + PropTripleObject.Text); } else if (PropTriplePredicate.Text == "causesWhy") { dm.AddTriple("mo:" + PropTripleSubject.Text, "wikiProperty:P2868", "mo:" + PropTripleObject.Text); } else { dm.AddTriple("mo:" + PropTripleSubject.Text, "mp:" + PropTriplePredicate.Text, "mo:" + PropTripleObject.Text); } MessageBox.Show("Success!", "Triple asserted!"); InitItemsSources(); }