Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
63;910036;"English";492014;"Gellish";491285;"statement";;1228;"can be an element of a";1004160;6066;"is a base phrase for";;1228;"conceptual collection relation of an individual thing";;;;;;1045;"facts about kinds of relations";"accepted";;"6-okt-99";"6-okt-99";"ISO 10303-221 modelling team";"ISO 10303-221:2002"
64;910036;"English";589830;"Gellish alternative";491285;"statement";;1228;"can be a collection with as element a";1004673;1986;"is an inverse phrase for";;1228;"conceptual collection relation of an individual thing";;;;;;1045;"facts about conceptual relations";"accepted";;"23-jun-00";"18-feb-10";"Andries van Renssen";"Andries van Renssen"
65;910036;"English";492014;"Gellish";491285;"statement";;1228;"can have as element a";1026682;1986;"is an inverse phrase for";;1228;"conceptual collection relation of an individual thing";;;;;;1045;"facts about conceptual relations";"accepted";;"18-feb-10";"18-feb-10";"Andries van Renssen";"Andries van Renssen"
66;910036;"English";193259;"ontology";491285;"statement";;1229;"qualitative aspect";1001309;1146;"is a kind of";;4947;"qualitative kind";"that is a kind of aspect with a particular qualitative or quantitative value that is intended to qualify aspects. It can be a particular value, or a range or a collection of explicit types (allowed values for individual aspects). Examples of qualitative aspects are: red";"is a qualitative kind that is a kind of aspect with a particular qualitative or quantitative value that is intended to qualify aspects. It can be a particular value, or a range or a collection of explicit types (allowed values for individual aspects). Examples of qualitative aspects are: red, dry and a piece of text (qualitative information). Examples of quantitative aspect are: '½', '3 kg' and '6 at the scale of Richter'.";;;;1049;"facts about concepts";"accepted";;"3-dec-98";"9-feb-04";"Andries van Renssen";"Andries van Renssen"
66;910036;"English";193259;"ontology";491285;"statement";;1229;"qualitative aspect";1001309;1146;"is a kind of";;4947;"qualitative kind";"that is a kind of aspect with a particular qualitative or quantitative value that is intended to qualify aspects. It can be a particular value, or a range or a collection of explicit types (allowed values for individual aspects). Examples of qualitative aspects are: red";"is a qualitative kind that is a kind of aspect with a particular qualitative or quantitative value that is intended to qualify aspects. It can be a particular value, or a range or a collection of explicit types (allowed values for individual aspects). Examples of qualitative aspects are: red, dry and a piece of text (qualitative information). Examples of quantitative aspect are: '1/2', '3 kg' and '6 at the scale of Richter'.";;;;1049;"facts about concepts";"accepted";;"3-dec-98";"9-feb-04";"Andries van Renssen";"Andries van Renssen"
67;910036;"English";193259;"ontology";491285;"statement";;1229;"qualitative value";1007440;1981;"is a synonym of";;1229;"qualitative aspect";;;;;;1049;"facts about concepts";"accepted";;"31-jan-03";"21-dec-12";"Andries van Renssen";"Andries van Renssen"
68;910036;"English";193259;"ontology";491285;"statement";;1229;"defined aspect";1007392;1981;"is a synonym of";;1229;"qualitative aspect";;;;;;1049;"facts about concepts";"accepted";;"3-dec-98";"9-feb-04";"Andries van Renssen";"Andries van Renssen"
71;910036;"English";193259;"ontology";491285;"statement";;1231;"conceptual binary relation between things of specified kinds";1004638;1146;"is a kind of";;4698;"conceptual relation between things of specified kinds";"that relates two kinds of things by a conceptual relation of a specified kind specifying that individual things of those kinds can have a possible relationship of a kind that is a relatization of the specified conceptual kind. A related kind can be either a conceptual or a qualitative (including quantitative) kind. Note that which kind of relation can be a realization of a conceptual kind of relation is specified separately.";;;;;1045;"facts about conceptual relations";"accepted";;"6-nov-02";"19-jul-13";"Andries van Renssen";"ISO 10303-221:2002"
Expand Down Expand Up @@ -844,7 +844,7 @@
831;910036;"English";192696;"business";491285;"statement";;640128;"time frame of occurrence";1640168;1146;"is a kind of";;4331;"intrinsic time aspect";"being a role of period in time indicating a period within which something happens. The time frame may be wider than the occurrence periode, with the duration of the happening.";"is a intrinsic time aspect being a role of period in time indicating a period within which something happens. The time frame may be wider than the occurrence periode, with the duration of the happening.";;;;553310;"facts about kinds of roles";"accepted";;"22-aug-02";"1-dec-05";"Andries van Renssen";"Shell Design and Engineering Practices"
832;910036;"English";192696;"business";491285;"statement";;640129;"date of occurrence";1007842;1146;"is a kind of";;640128;"time frame of occurrence";"being the role of a time period that indicates the period within which something occurs. Typically a date that is referred by a year, a month in the year and a day in the month.";"is a time frame of occurrence being the role of a time period that indicates the period within which something occurs. Typically a date that is referred by a year, a month in the year and a day in the month.";;;;553310;"facts about kinds of roles";"accepted";;"19-nov-02";"9-dec-03";"Fred Vonk";"Shell Design and Engineering Practices"
833;910036;"English";192696;"business";491285;"statement";;640129;"date of happening";1640172;1981;"is a synonym of";;640129;"date of occurrence";;;;;;553310;"facts about kinds of roles";"accepted";;"22-aug-02";"9-dec-03";"Andries van Renssen";"Shell Design and Engineering Practices"
834;910036;"English";193259;"ontology";491285;"statement";;730000;"anything";1026496;1981;"is a synonym of";;730000;"what can be thought of.";;;;;;1047;"facts about kinds of relations between individual things";"accepted";;"27-nov-08";"27-nov-08";"Andries van Renssen";"Andries van Renssen"
834;910036;"English";193259;"ontology";491285;"statement";;730000;"anything";1026496;1981;"is a synonym of";;730000;"what can be thought of.";"what can be thought of.";;;;;1047;"facts about kinds of relations between individual things";"accepted";;"27-nov-08";"27-nov-08";"Andries van Renssen";"Andries van Renssen"
835;910036;"English";191874;"physics";491285;"statement";;730019;"solid item";1007836;1146;"is a kind of";;160177;"material";"that is solid and has a defined shape. It can be a single item or a collection of items or an assembly of items.";;;;;1049;"facts about concepts";"accepted";;"15-apr-96";"13-mei-03";"Fred Vonk";"item peers"
836;910036;"English";193259;"ontology";491285;"statement";;730019;"thing";1001090;1981;"is a synonym of";;730019;"solid item";;;;;;1049;"facts about concepts";"accepted";;"21-mrt-01";"25-okt-12";"Andries van Renssen";"Epstle Core Model modelling team"
837;910036;"English";191874;"physics";491285;"statement";;730019;"solid physical object";1027347;1981;"is a synonym of";;730019;"solid item";;;;;;1049;"facts about concepts";"accepted";;"27-jun-12";"27-jun-12";"Andries van Renssen";"Andries van Renssen"
Expand Down
62 changes: 61 additions & 1 deletion Web-Communicator/Anything.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,31 @@ def __init__(self, uid, name, category=None):

def add_name_in_context(self, name_in_context):
''' add name or alias to collection of names:
name_in_context = (languageUID, communityUID, naming_relationUID, name).
name_in_context = (languageUID, communityUID, naming_relationUID, name, descr).
'''
if name_in_context not in self.names_in_contexts:
self.names_in_contexts.append(name_in_context)

def add_must_phrase(self, name_in_context):
""" Test whether name_in_context is a phrase that starts with 'shall',
if yes, then add a base phrase or inverse phrase that starts with 'must'.
name_in_context = languageUID, communityUID, name, naming_relationUID, descr
"""
new_phrase = ''
phrase = name_in_context[2]
phrase_parts = phrase.split(' ')
# If phrase is an English phrase that starts with 'shall'
# then a new phrase is added in which shall is replaced by must
if name_in_context[0] == '910036' and len(phrase_parts) > 2 \
and phrase_parts[0] == 'shall':
new_phrase = 'must' + phrase[5:]
new_name_in_context = name_in_context[:]
new_name_in_context[2] = new_phrase
if new_name_in_context not in self.names_in_contexts:
self.names_in_contexts.append(new_name_in_context)
naming_rel_uid = new_name_in_context[3]
return new_phrase

def add_relation(self, relation):
''' add relation object to collection of relations with self.'''
if relation not in self.relations:
Expand Down Expand Up @@ -192,3 +212,43 @@ def __repr__(self):
return("Idea: {} lh_uid: {} ({}) {} rh_uid: {}".
format(self.uid, self.lh_obj.uid, self.rel_type.uid,
self.phrase_type_uid, self.rh_obj.uid))


if __name__ == "__main__":
# Test
from SemanticNetwork import Semantic_Network
language_uid_en = '910036' # English
language_uid_nl = '910037' # Dutch
community_uid = '492014' # Gellish
test_phrases = {'1': 'rel',
'2': 'shall have as part a',
'3': 'shall be a part of a',
'4': 'must be a part of a'}
GUI_lang_index = 0
net_name = 'Net'
gel_net = Semantic_Network(GUI_lang_index, net_name)
names = test_phrases
language_uid = language_uid_en
gel_net.lang_uid_dict[language_uid] = language_uid_en
naming_relation_uid = '6066'
base_naming_relation_uid = '6066'
inv_naming_relation_uid = '1986'
gel_net.total_base_phrases = []
gel_net.total_inverse_phrases = []
for uid in names:
name = names[uid]
obj = Anything(uid, name)
obj.category = 'kind of relation'
descr = 'something'
name_in_context = [language_uid, community_uid, name, naming_relation_uid, descr]
obj.add_name_in_context(name_in_context)

new_phrase = obj.add_must_phrase(name_in_context)

if naming_relation_uid == '6066':
gel_net.total_base_phrases.append(new_phrase)
naming_relation_uid = inv_naming_relation_uid
else:
gel_net.total_inverse_phrases.append(new_phrase)
naming_relation_uid = base_naming_relation_uid
print('Phrase/New phrase: {} / {}'.format(name_in_context, new_phrase))
53 changes: 33 additions & 20 deletions Web-Communicator/Create_output_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import json
from rdflib import Graph, URIRef, RDFS
# Namespace, Literal, RDF, BNode
from tkinter import filedialog
# from tkinter import filedialog
import remi.gui as gui

from Bootstrapping import ini_out_path
# from Expr_Table_Def import *
Expand Down Expand Up @@ -59,7 +60,8 @@ def Open_output_file(expressions, subject_name, lang_name, serialization):
else:
header1 = ['Gellish', 'English', 'Version', '9.0', date, 'Results',
'about ' + subject_name]
res = 'Results-'
res = 'Query_results-'
ini_file_name = ''
if serialization == 'csv':
ini_file_name = res + subject_name + '.csv.csv'
if serialization == 'xml':
Expand All @@ -73,44 +75,51 @@ def Open_output_file(expressions, subject_name, lang_name, serialization):

# Select file name and directory
# Ini_out_path from Bootstrapping
title = serialization + ' files'
extension = '*.' + serialization
output_file = filedialog.asksaveasfilename(filetypes=((title, extension),
("All files", "*.*")),
title="Enter a file name",
initialdir=ini_out_path,
initialfile=ini_file_name)
if output_file == '':
## title = serialization + ' files'
## extension = '*.' + serialization
## output_file = filedialog.asksaveasfilename(filetypes=((title, extension),
## ("All files", "*.*")),
## title="Enter a file name",
## initialdir=ini_out_path,
## initialfile=ini_file_name)
output_file_name = ini_file_name
if output_file_name == '':
output_file = 'Results.' + serialization
if lang_name == 'Nederlands':
print('***De filenaam voor opslaan is blanco of the file selectie is gecancelled. '
'De file is opgeslagen met de naam ' + output_file)
'De file met naam ' + output_file + ' is niet opgeslagen')
else:
print('***File name for saving is blank or file selection is cancelled. '
'The file is saved under name ' + output_file)
Save_expressions_in_file(expressions, output_file, header1, serialization)
'The file with name ' + output_file + 'is not saved')
else:
Save_expressions_in_file(expressions, output_file_name, header1, serialization)

def fileupload_on_success(widget, filename):
print('File upload success: ' + filename)

def fileupload_on_failed(widget, filename):
print('File upload failed: ' + filename)

def Save_expressions_in_file(expressions, output_file, header1, serialization):
'''Write expressions to an output file in an CSV or RDF serialization'''

if serialization == 'csv':
# Save the result_expr expressions in a CSV file, preceeded by three header lines.
try:
f = open(output_file, mode='w', newline='', encoding='utf-8')
fileWriter = csv.writer(f, dialect='excel', delimiter=';')
f = open(output_file, mode='a', newline='', encoding='utf-8')
file_writer = csv.writer(f, dialect='excel', delimiter=';')

# Write header rows and expressions
fileWriter.writerow(header1)
fileWriter.writerow(expr_col_ids)
fileWriter.writerow(header3)
file_writer.writerow(header1)
file_writer.writerow(expr_col_ids)
file_writer.writerow(header3)
for expression in expressions:
fileWriter.writerow(expression)
file_writer.writerow(expression)

f.close()

# Open the written file in a CSV viewer (e.g. Excel)
open_file(output_file)
# open_file(output_file)
except PermissionError:
print('File {} cannot be opened. Probably already in use'.format(output_file))
return
Expand Down Expand Up @@ -151,6 +160,10 @@ def Save_expressions_in_file(expressions, output_file, header1, serialization):
# Open written file in a viewer
open_file(output_file)

output_file = gui.FileUploader('./', width=200, height=30, margin='10px')
output_file.onsuccess.connect(fileupload_on_success)
output_file.onfailed.connect(fileupload_on_failed)


def Convert_numeric_to_integer(numeric_text):
''' Convert a numeric string into integer value removing dots(.), commas(,) and spaces( )
Expand Down
Loading