Browse Source

first commit

Ademar Crotti Junior 6 years ago
commit
9e1df7a745
10 changed files with 3163 additions and 0 deletions
  1. 1424 0
      blockly_compressed.js
  2. 141 0
      blocks_compressed.js
  3. 6 0
      bootstrap-theme.min.css
  4. 6 0
      bootstrap.min.css
  5. 7 0
      bootstrap.min.js
  6. 394 0
      en.js
  7. 217 0
      index.html
  8. 4 0
      jquery-2.1.4.min.js
  9. 607 0
      r2rml.js
  10. 357 0
      r2rml_generator.js

File diff suppressed because it is too large
+ 1424 - 0
blockly_compressed.js


File diff suppressed because it is too large
+ 141 - 0
blocks_compressed.js


File diff suppressed because it is too large
+ 6 - 0
bootstrap-theme.min.css


File diff suppressed because it is too large
+ 6 - 0
bootstrap.min.css


File diff suppressed because it is too large
+ 7 - 0
bootstrap.min.js


+ 394 - 0
en.js

@@ -0,0 +1,394 @@
+// This file was automatically generated.  Do not modify.
+
+'use strict';
+
+goog.provide('Blockly.Msg.en');
+
+goog.require('Blockly.Msg');
+
+Blockly.Msg.ADD_COMMENT = "Add Comment";
+Blockly.Msg.AUTH = "Please authorize this app to enable your work to be saved and to allow it to be shared by you.";
+Blockly.Msg.CHANGE_VALUE_TITLE = "Change value:";
+Blockly.Msg.CHAT = "Chat with your collaborator by typing in this box!";
+Blockly.Msg.CLEAN_UP = "Clean up Blocks";
+Blockly.Msg.COLLAPSE_ALL = "Collapse Blocks";
+Blockly.Msg.COLLAPSE_BLOCK = "Collapse Block";
+Blockly.Msg.COLOUR_BLEND_COLOUR1 = "colour 1";
+Blockly.Msg.COLOUR_BLEND_COLOUR2 = "colour 2";
+Blockly.Msg.COLOUR_BLEND_HELPURL = "http://meyerweb.com/eric/tools/color-blend/";
+Blockly.Msg.COLOUR_BLEND_RATIO = "ratio";
+Blockly.Msg.COLOUR_BLEND_TITLE = "blend";
+Blockly.Msg.COLOUR_BLEND_TOOLTIP = "Blends two colours together with a given ratio (0.0 - 1.0).";
+Blockly.Msg.COLOUR_PICKER_HELPURL = "https://en.wikipedia.org/wiki/Color";
+Blockly.Msg.COLOUR_PICKER_TOOLTIP = "Choose a colour from the palette.";
+Blockly.Msg.COLOUR_RANDOM_HELPURL = "http://randomcolour.com";
+Blockly.Msg.COLOUR_RANDOM_TITLE = "random colour";
+Blockly.Msg.COLOUR_RANDOM_TOOLTIP = "Choose a colour at random.";
+Blockly.Msg.COLOUR_RGB_BLUE = "blue";
+Blockly.Msg.COLOUR_RGB_GREEN = "green";
+Blockly.Msg.COLOUR_RGB_HELPURL = "http://www.december.com/html/spec/colorper.html";
+Blockly.Msg.COLOUR_RGB_RED = "red";
+Blockly.Msg.COLOUR_RGB_TITLE = "colour with";
+Blockly.Msg.COLOUR_RGB_TOOLTIP = "Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 100.";
+Blockly.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL = "https://github.com/google/blockly/wiki/Loops#loop-termination-blocks";
+Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK = "break out of loop";
+Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE = "continue with next iteration of loop";
+Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK = "Break out of the containing loop.";
+Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE = "Skip the rest of this loop, and continue with the next iteration.";
+Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING = "Warning: This block may only be used within a loop.";
+Blockly.Msg.CONTROLS_FOREACH_HELPURL = "https://github.com/google/blockly/wiki/Loops#for-each";
+Blockly.Msg.CONTROLS_FOREACH_TITLE = "for each item %1 in list %2";
+Blockly.Msg.CONTROLS_FOREACH_TOOLTIP = "For each item in a list, set the variable '%1' to the item, and then do some statements.";
+Blockly.Msg.CONTROLS_FOR_HELPURL = "https://github.com/google/blockly/wiki/Loops#count-with";
+Blockly.Msg.CONTROLS_FOR_TITLE = "count with %1 from %2 to %3 by %4";
+Blockly.Msg.CONTROLS_FOR_TOOLTIP = "Have the variable '%1' take on the values from the start number to the end number, counting by the specified interval, and do the specified blocks.";
+Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP = "Add a condition to the if block.";
+Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP = "Add a final, catch-all condition to the if block.";
+Blockly.Msg.CONTROLS_IF_HELPURL = "https://github.com/google/blockly/wiki/IfElse";
+Blockly.Msg.CONTROLS_IF_IF_TOOLTIP = "Add, remove, or reorder sections to reconfigure this if block.";
+Blockly.Msg.CONTROLS_IF_MSG_ELSE = "else";
+Blockly.Msg.CONTROLS_IF_MSG_ELSEIF = "else if";
+Blockly.Msg.CONTROLS_IF_MSG_IF = "if";
+Blockly.Msg.CONTROLS_IF_TOOLTIP_1 = "If a value is true, then do some statements.";
+Blockly.Msg.CONTROLS_IF_TOOLTIP_2 = "If a value is true, then do the first block of statements. Otherwise, do the second block of statements.";
+Blockly.Msg.CONTROLS_IF_TOOLTIP_3 = "If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements.";
+Blockly.Msg.CONTROLS_IF_TOOLTIP_4 = "If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements. If none of the values are true, do the last block of statements.";
+Blockly.Msg.CONTROLS_REPEAT_HELPURL = "https://en.wikipedia.org/wiki/For_loop";
+Blockly.Msg.CONTROLS_REPEAT_INPUT_DO = "do";
+Blockly.Msg.CONTROLS_REPEAT_TITLE = "repeat %1 times";
+Blockly.Msg.CONTROLS_REPEAT_TOOLTIP = "Do some statements several times.";
+Blockly.Msg.CONTROLS_WHILEUNTIL_HELPURL = "https://github.com/google/blockly/wiki/Loops#repeat";
+Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL = "repeat until";
+Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE = "repeat while";
+Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL = "While a value is false, then do some statements.";
+Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE = "While a value is true, then do some statements.";
+Blockly.Msg.DELETE_ALL_BLOCKS = "Delete all %1 blocks?";
+Blockly.Msg.DELETE_BLOCK = "Delete Block";
+Blockly.Msg.DELETE_X_BLOCKS = "Delete %1 Blocks";
+Blockly.Msg.DISABLE_BLOCK = "Disable Block";
+Blockly.Msg.DUPLICATE_BLOCK = "Duplicate";
+Blockly.Msg.ENABLE_BLOCK = "Enable Block";
+Blockly.Msg.EXPAND_ALL = "Expand Blocks";
+Blockly.Msg.EXPAND_BLOCK = "Expand Block";
+Blockly.Msg.EXTERNAL_INPUTS = "External Inputs";
+Blockly.Msg.HELP = "Help";
+Blockly.Msg.INLINE_INPUTS = "Inline Inputs";
+Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL = "https://github.com/google/blockly/wiki/Lists#create-empty-list";
+Blockly.Msg.LISTS_CREATE_EMPTY_TITLE = "create empty list";
+Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP = "Returns a list, of length 0, containing no data records";
+Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD = "list";
+Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP = "Add, remove, or reorder sections to reconfigure this list block.";
+Blockly.Msg.LISTS_CREATE_WITH_HELPURL = "https://github.com/google/blockly/wiki/Lists#create-list-with";
+Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH = "create list with";
+Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP = "Add an item to the list.";
+Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP = "Create a list with any number of items.";
+Blockly.Msg.LISTS_GET_INDEX_FIRST = "first";
+Blockly.Msg.LISTS_GET_INDEX_FROM_END = "# from end";
+Blockly.Msg.LISTS_GET_INDEX_FROM_START = "#";
+Blockly.Msg.LISTS_GET_INDEX_GET = "get";
+Blockly.Msg.LISTS_GET_INDEX_GET_REMOVE = "get and remove";
+Blockly.Msg.LISTS_GET_INDEX_LAST = "last";
+Blockly.Msg.LISTS_GET_INDEX_RANDOM = "random";
+Blockly.Msg.LISTS_GET_INDEX_REMOVE = "remove";
+Blockly.Msg.LISTS_GET_INDEX_TAIL = "";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST = "Returns the first item in a list.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM_END = "Returns the item at the specified position in a list. #1 is the last item.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM_START = "Returns the item at the specified position in a list. #1 is the first item.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST = "Returns the last item in a list.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM = "Returns a random item in a list.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST = "Removes and returns the first item in a list.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_END = "Removes and returns the item at the specified position in a list. #1 is the last item.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_START = "Removes and returns the item at the specified position in a list. #1 is the first item.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST = "Removes and returns the last item in a list.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM = "Removes and returns a random item in a list.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST = "Removes the first item in a list.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_END = "Removes the item at the specified position in a list. #1 is the last item.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_START = "Removes the item at the specified position in a list. #1 is the first item.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST = "Removes the last item in a list.";
+Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM = "Removes a random item in a list.";
+Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_END = "to # from end";
+Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_START = "to #";
+Blockly.Msg.LISTS_GET_SUBLIST_END_LAST = "to last";
+Blockly.Msg.LISTS_GET_SUBLIST_HELPURL = "https://github.com/google/blockly/wiki/Lists#getting-a-sublist";
+Blockly.Msg.LISTS_GET_SUBLIST_START_FIRST = "get sub-list from first";
+Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_END = "get sub-list from # from end";
+Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_START = "get sub-list from #";
+Blockly.Msg.LISTS_GET_SUBLIST_TAIL = "";
+Blockly.Msg.LISTS_GET_SUBLIST_TOOLTIP = "Creates a copy of the specified portion of a list.";
+Blockly.Msg.LISTS_INDEX_OF_FIRST = "find first occurrence of item";
+Blockly.Msg.LISTS_INDEX_OF_HELPURL = "https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list";
+Blockly.Msg.LISTS_INDEX_OF_LAST = "find last occurrence of item";
+Blockly.Msg.LISTS_INDEX_OF_TOOLTIP = "Returns the index of the first/last occurrence of the item in the list. Returns 0 if item is not found.";
+Blockly.Msg.LISTS_INLIST = "in list";
+Blockly.Msg.LISTS_ISEMPTY_HELPURL = "https://github.com/google/blockly/wiki/Lists#is-empty";
+Blockly.Msg.LISTS_ISEMPTY_TITLE = "%1 is empty";
+Blockly.Msg.LISTS_ISEMPTY_TOOLTIP = "Returns true if the list is empty.";
+Blockly.Msg.LISTS_LENGTH_HELPURL = "https://github.com/google/blockly/wiki/Lists#length-of";
+Blockly.Msg.LISTS_LENGTH_TITLE = "length of %1";
+Blockly.Msg.LISTS_LENGTH_TOOLTIP = "Returns the length of a list.";
+Blockly.Msg.LISTS_REPEAT_HELPURL = "https://github.com/google/blockly/wiki/Lists#create-list-with";
+Blockly.Msg.LISTS_REPEAT_TITLE = "create list with item %1 repeated %2 times";
+Blockly.Msg.LISTS_REPEAT_TOOLTIP = "Creates a list consisting of the given value repeated the specified number of times.";
+Blockly.Msg.LISTS_SET_INDEX_HELPURL = "https://github.com/google/blockly/wiki/Lists#in-list--set";
+Blockly.Msg.LISTS_SET_INDEX_INPUT_TO = "as";
+Blockly.Msg.LISTS_SET_INDEX_INSERT = "insert at";
+Blockly.Msg.LISTS_SET_INDEX_SET = "set";
+Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST = "Inserts the item at the start of a list.";
+Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_END = "Inserts the item at the specified position in a list. #1 is the last item.";
+Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_START = "Inserts the item at the specified position in a list. #1 is the first item.";
+Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST = "Append the item to the end of a list.";
+Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM = "Inserts the item randomly in a list.";
+Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST = "Sets the first item in a list.";
+Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM_END = "Sets the item at the specified position in a list. #1 is the last item.";
+Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM_START = "Sets the item at the specified position in a list. #1 is the first item.";
+Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST = "Sets the last item in a list.";
+Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM = "Sets a random item in a list.";
+Blockly.Msg.LISTS_SORT_HELPURL = "https://github.com/google/blockly/wiki/Lists#sorting-a-list";
+Blockly.Msg.LISTS_SORT_ORDER_ASCENDING = "ascending";
+Blockly.Msg.LISTS_SORT_ORDER_DESCENDING = "descending";
+Blockly.Msg.LISTS_SORT_TITLE = "sort %1 %2 %3";
+Blockly.Msg.LISTS_SORT_TOOLTIP = "Sort a copy of a list.";
+Blockly.Msg.LISTS_SORT_TYPE_IGNORECASE = "alphabetic, ignore case";
+Blockly.Msg.LISTS_SORT_TYPE_NUMERIC = "numeric";
+Blockly.Msg.LISTS_SORT_TYPE_TEXT = "alphabetic";
+Blockly.Msg.LISTS_SPLIT_HELPURL = "https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists";
+Blockly.Msg.LISTS_SPLIT_LIST_FROM_TEXT = "make list from text";
+Blockly.Msg.LISTS_SPLIT_TEXT_FROM_LIST = "make text from list";
+Blockly.Msg.LISTS_SPLIT_TOOLTIP_JOIN = "Join a list of texts into one text, separated by a delimiter.";
+Blockly.Msg.LISTS_SPLIT_TOOLTIP_SPLIT = "Split text into a list of texts, breaking at each delimiter.";
+Blockly.Msg.LISTS_SPLIT_WITH_DELIMITER = "with delimiter";
+Blockly.Msg.LOGIC_BOOLEAN_FALSE = "false";
+Blockly.Msg.LOGIC_BOOLEAN_HELPURL = "https://github.com/google/blockly/wiki/Logic#values";
+Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP = "Returns either true or false.";
+Blockly.Msg.LOGIC_BOOLEAN_TRUE = "true";
+Blockly.Msg.LOGIC_COMPARE_HELPURL = "https://en.wikipedia.org/wiki/Inequality_(mathematics)";
+Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ = "Return true if both inputs equal each other.";
+Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT = "Return true if the first input is greater than the second input.";
+Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE = "Return true if the first input is greater than or equal to the second input.";
+Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT = "Return true if the first input is smaller than the second input.";
+Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE = "Return true if the first input is smaller than or equal to the second input.";
+Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ = "Return true if both inputs are not equal to each other.";
+Blockly.Msg.LOGIC_NEGATE_HELPURL = "https://github.com/google/blockly/wiki/Logic#not";
+Blockly.Msg.LOGIC_NEGATE_TITLE = "not %1";
+Blockly.Msg.LOGIC_NEGATE_TOOLTIP = "Returns true if the input is false. Returns false if the input is true.";
+Blockly.Msg.LOGIC_NULL = "null";
+Blockly.Msg.LOGIC_NULL_HELPURL = "https://en.wikipedia.org/wiki/Nullable_type";
+Blockly.Msg.LOGIC_NULL_TOOLTIP = "Returns null.";
+Blockly.Msg.LOGIC_OPERATION_AND = "and";
+Blockly.Msg.LOGIC_OPERATION_HELPURL = "https://github.com/google/blockly/wiki/Logic#logical-operations";
+Blockly.Msg.LOGIC_OPERATION_OR = "or";
+Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND = "Return true if both inputs are true.";
+Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR = "Return true if at least one of the inputs is true.";
+Blockly.Msg.LOGIC_TERNARY_CONDITION = "test";
+Blockly.Msg.LOGIC_TERNARY_HELPURL = "https://en.wikipedia.org/wiki/%3F:";
+Blockly.Msg.LOGIC_TERNARY_IF_FALSE = "if false";
+Blockly.Msg.LOGIC_TERNARY_IF_TRUE = "if true";
+Blockly.Msg.LOGIC_TERNARY_TOOLTIP = "Check the condition in 'test'. If the condition is true, returns the 'if true' value; otherwise returns the 'if false' value.";
+Blockly.Msg.MATH_ADDITION_SYMBOL = "+";
+Blockly.Msg.MATH_ARITHMETIC_HELPURL = "https://en.wikipedia.org/wiki/Arithmetic";
+Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_ADD = "Return the sum of the two numbers.";
+Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE = "Return the quotient of the two numbers.";
+Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS = "Return the difference of the two numbers.";
+Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY = "Return the product of the two numbers.";
+Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_POWER = "Return the first number raised to the power of the second number.";
+Blockly.Msg.MATH_CHANGE_HELPURL = "https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter";
+Blockly.Msg.MATH_CHANGE_TITLE = "change %1 by %2";
+Blockly.Msg.MATH_CHANGE_TOOLTIP = "Add a number to variable '%1'.";
+Blockly.Msg.MATH_CONSTANT_HELPURL = "https://en.wikipedia.org/wiki/Mathematical_constant";
+Blockly.Msg.MATH_CONSTANT_TOOLTIP = "Return one of the common constants: π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…), or ∞ (infinity).";
+Blockly.Msg.MATH_CONSTRAIN_HELPURL = "https://en.wikipedia.org/wiki/Clamping_%28graphics%29";
+Blockly.Msg.MATH_CONSTRAIN_TITLE = "constrain %1 low %2 high %3";
+Blockly.Msg.MATH_CONSTRAIN_TOOLTIP = "Constrain a number to be between the specified limits (inclusive).";
+Blockly.Msg.MATH_DIVISION_SYMBOL = "÷";
+Blockly.Msg.MATH_IS_DIVISIBLE_BY = "is divisible by";
+Blockly.Msg.MATH_IS_EVEN = "is even";
+Blockly.Msg.MATH_IS_NEGATIVE = "is negative";
+Blockly.Msg.MATH_IS_ODD = "is odd";
+Blockly.Msg.MATH_IS_POSITIVE = "is positive";
+Blockly.Msg.MATH_IS_PRIME = "is prime";
+Blockly.Msg.MATH_IS_TOOLTIP = "Check if a number is an even, odd, prime, whole, positive, negative, or if it is divisible by certain number. Returns true or false.";
+Blockly.Msg.MATH_IS_WHOLE = "is whole";
+Blockly.Msg.MATH_MODULO_HELPURL = "https://en.wikipedia.org/wiki/Modulo_operation";
+Blockly.Msg.MATH_MODULO_TITLE = "remainder of %1 ÷ %2";
+Blockly.Msg.MATH_MODULO_TOOLTIP = "Return the remainder from dividing the two numbers.";
+Blockly.Msg.MATH_MULTIPLICATION_SYMBOL = "×";
+Blockly.Msg.MATH_NUMBER_HELPURL = "https://en.wikipedia.org/wiki/Number";
+Blockly.Msg.MATH_NUMBER_TOOLTIP = "A number.";
+Blockly.Msg.MATH_ONLIST_HELPURL = "";
+Blockly.Msg.MATH_ONLIST_OPERATOR_AVERAGE = "average of list";
+Blockly.Msg.MATH_ONLIST_OPERATOR_MAX = "max of list";
+Blockly.Msg.MATH_ONLIST_OPERATOR_MEDIAN = "median of list";
+Blockly.Msg.MATH_ONLIST_OPERATOR_MIN = "min of list";
+Blockly.Msg.MATH_ONLIST_OPERATOR_MODE = "modes of list";
+Blockly.Msg.MATH_ONLIST_OPERATOR_RANDOM = "random item of list";
+Blockly.Msg.MATH_ONLIST_OPERATOR_STD_DEV = "standard deviation of list";
+Blockly.Msg.MATH_ONLIST_OPERATOR_SUM = "sum of list";
+Blockly.Msg.MATH_ONLIST_TOOLTIP_AVERAGE = "Return the average (arithmetic mean) of the numeric values in the list.";
+Blockly.Msg.MATH_ONLIST_TOOLTIP_MAX = "Return the largest number in the list.";
+Blockly.Msg.MATH_ONLIST_TOOLTIP_MEDIAN = "Return the median number in the list.";
+Blockly.Msg.MATH_ONLIST_TOOLTIP_MIN = "Return the smallest number in the list.";
+Blockly.Msg.MATH_ONLIST_TOOLTIP_MODE = "Return a list of the most common item(s) in the list.";
+Blockly.Msg.MATH_ONLIST_TOOLTIP_RANDOM = "Return a random element from the list.";
+Blockly.Msg.MATH_ONLIST_TOOLTIP_STD_DEV = "Return the standard deviation of the list.";
+Blockly.Msg.MATH_ONLIST_TOOLTIP_SUM = "Return the sum of all the numbers in the list.";
+Blockly.Msg.MATH_POWER_SYMBOL = "^";
+Blockly.Msg.MATH_RANDOM_FLOAT_HELPURL = "https://en.wikipedia.org/wiki/Random_number_generation";
+Blockly.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM = "random fraction";
+Blockly.Msg.MATH_RANDOM_FLOAT_TOOLTIP = "Return a random fraction between 0.0 (inclusive) and 1.0 (exclusive).";
+Blockly.Msg.MATH_RANDOM_INT_HELPURL = "https://en.wikipedia.org/wiki/Random_number_generation";
+Blockly.Msg.MATH_RANDOM_INT_TITLE = "random integer from %1 to %2";
+Blockly.Msg.MATH_RANDOM_INT_TOOLTIP = "Return a random integer between the two specified limits, inclusive.";
+Blockly.Msg.MATH_ROUND_HELPURL = "https://en.wikipedia.org/wiki/Rounding";
+Blockly.Msg.MATH_ROUND_OPERATOR_ROUND = "round";
+Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN = "round down";
+Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDUP = "round up";
+Blockly.Msg.MATH_ROUND_TOOLTIP = "Round a number up or down.";
+Blockly.Msg.MATH_SINGLE_HELPURL = "https://en.wikipedia.org/wiki/Square_root";
+Blockly.Msg.MATH_SINGLE_OP_ABSOLUTE = "absolute";
+Blockly.Msg.MATH_SINGLE_OP_ROOT = "square root";
+Blockly.Msg.MATH_SINGLE_TOOLTIP_ABS = "Return the absolute value of a number.";
+Blockly.Msg.MATH_SINGLE_TOOLTIP_EXP = "Return e to the power of a number.";
+Blockly.Msg.MATH_SINGLE_TOOLTIP_LN = "Return the natural logarithm of a number.";
+Blockly.Msg.MATH_SINGLE_TOOLTIP_LOG10 = "Return the base 10 logarithm of a number.";
+Blockly.Msg.MATH_SINGLE_TOOLTIP_NEG = "Return the negation of a number.";
+Blockly.Msg.MATH_SINGLE_TOOLTIP_POW10 = "Return 10 to the power of a number.";
+Blockly.Msg.MATH_SINGLE_TOOLTIP_ROOT = "Return the square root of a number.";
+Blockly.Msg.MATH_SUBTRACTION_SYMBOL = "-";
+Blockly.Msg.MATH_TRIG_ACOS = "acos";
+Blockly.Msg.MATH_TRIG_ASIN = "asin";
+Blockly.Msg.MATH_TRIG_ATAN = "atan";
+Blockly.Msg.MATH_TRIG_COS = "cos";
+Blockly.Msg.MATH_TRIG_HELPURL = "https://en.wikipedia.org/wiki/Trigonometric_functions";
+Blockly.Msg.MATH_TRIG_SIN = "sin";
+Blockly.Msg.MATH_TRIG_TAN = "tan";
+Blockly.Msg.MATH_TRIG_TOOLTIP_ACOS = "Return the arccosine of a number.";
+Blockly.Msg.MATH_TRIG_TOOLTIP_ASIN = "Return the arcsine of a number.";
+Blockly.Msg.MATH_TRIG_TOOLTIP_ATAN = "Return the arctangent of a number.";
+Blockly.Msg.MATH_TRIG_TOOLTIP_COS = "Return the cosine of a degree (not radian).";
+Blockly.Msg.MATH_TRIG_TOOLTIP_SIN = "Return the sine of a degree (not radian).";
+Blockly.Msg.MATH_TRIG_TOOLTIP_TAN = "Return the tangent of a degree (not radian).";
+Blockly.Msg.ME = "Me";
+Blockly.Msg.NEW_VARIABLE = "New variable...";
+Blockly.Msg.NEW_VARIABLE_TITLE = "New variable name:";
+Blockly.Msg.ORDINAL_NUMBER_SUFFIX = "";
+Blockly.Msg.PROCEDURES_ALLOW_STATEMENTS = "allow statements";
+Blockly.Msg.PROCEDURES_BEFORE_PARAMS = "with:";
+Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29";
+Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP = "Run the user-defined function '%1'.";
+Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29";
+Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP = "Run the user-defined function '%1' and use its output.";
+Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS = "with:";
+Blockly.Msg.PROCEDURES_CREATE_DO = "Create '%1'";
+Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT = "Describe this function...";
+Blockly.Msg.PROCEDURES_DEFNORETURN_DO = "";
+Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29";
+Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE = "do something";
+Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE = "to";
+Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP = "Creates a function with no output.";
+Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29";
+Blockly.Msg.PROCEDURES_DEFRETURN_RETURN = "return";
+Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP = "Creates a function with an output.";
+Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING = "Warning: This function has duplicate parameters.";
+Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF = "Highlight function definition";
+Blockly.Msg.PROCEDURES_IFRETURN_HELPURL = "http://c2.com/cgi/wiki?GuardClause";
+Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP = "If a value is true, then return a second value.";
+Blockly.Msg.PROCEDURES_IFRETURN_WARNING = "Warning: This block may be used only within a function definition.";
+Blockly.Msg.PROCEDURES_MUTATORARG_TITLE = "input name:";
+Blockly.Msg.PROCEDURES_MUTATORARG_TOOLTIP = "Add an input to the function.";
+Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE = "inputs";
+Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP = "Add, remove, or reorder inputs to this function.";
+Blockly.Msg.REDO = "Redo";
+Blockly.Msg.REMOVE_COMMENT = "Remove Comment";
+Blockly.Msg.RENAME_VARIABLE = "Rename variable...";
+Blockly.Msg.RENAME_VARIABLE_TITLE = "Rename all '%1' variables to:";
+Blockly.Msg.TEXT_APPEND_APPENDTEXT = "append text";
+Blockly.Msg.TEXT_APPEND_HELPURL = "https://github.com/google/blockly/wiki/Text#text-modification";
+Blockly.Msg.TEXT_APPEND_TO = "to";
+Blockly.Msg.TEXT_APPEND_TOOLTIP = "Append some text to variable '%1'.";
+Blockly.Msg.TEXT_CHANGECASE_HELPURL = "https://github.com/google/blockly/wiki/Text#adjusting-text-case";
+Blockly.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE = "to lower case";
+Blockly.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE = "to Title Case";
+Blockly.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE = "to UPPER CASE";
+Blockly.Msg.TEXT_CHANGECASE_TOOLTIP = "Return a copy of the text in a different case.";
+Blockly.Msg.TEXT_CHARAT_FIRST = "get first letter";
+Blockly.Msg.TEXT_CHARAT_FROM_END = "get letter # from end";
+Blockly.Msg.TEXT_CHARAT_FROM_START = "get letter #";
+Blockly.Msg.TEXT_CHARAT_HELPURL = "https://github.com/google/blockly/wiki/Text#extracting-text";
+Blockly.Msg.TEXT_CHARAT_INPUT_INTEXT = "in text";
+Blockly.Msg.TEXT_CHARAT_LAST = "get last letter";
+Blockly.Msg.TEXT_CHARAT_RANDOM = "get random letter";
+Blockly.Msg.TEXT_CHARAT_TAIL = "";
+Blockly.Msg.TEXT_CHARAT_TOOLTIP = "Returns the letter at the specified position.";
+Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP = "Add an item to the text.";
+Blockly.Msg.TEXT_CREATE_JOIN_TITLE_JOIN = "join";
+Blockly.Msg.TEXT_CREATE_JOIN_TOOLTIP = "Add, remove, or reorder sections to reconfigure this text block.";
+Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_END = "to letter # from end";
+Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_START = "to letter #";
+Blockly.Msg.TEXT_GET_SUBSTRING_END_LAST = "to last letter";
+Blockly.Msg.TEXT_GET_SUBSTRING_HELPURL = "https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text";
+Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT = "in text";
+Blockly.Msg.TEXT_GET_SUBSTRING_START_FIRST = "get substring from first letter";
+Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_END = "get substring from letter # from end";
+Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_START = "get substring from letter #";
+Blockly.Msg.TEXT_GET_SUBSTRING_TAIL = "";
+Blockly.Msg.TEXT_GET_SUBSTRING_TOOLTIP = "Returns a specified portion of the text.";
+Blockly.Msg.TEXT_INDEXOF_HELPURL = "https://github.com/google/blockly/wiki/Text#finding-text";
+Blockly.Msg.TEXT_INDEXOF_INPUT_INTEXT = "in text";
+Blockly.Msg.TEXT_INDEXOF_OPERATOR_FIRST = "find first occurrence of text";
+Blockly.Msg.TEXT_INDEXOF_OPERATOR_LAST = "find last occurrence of text";
+Blockly.Msg.TEXT_INDEXOF_TAIL = "";
+Blockly.Msg.TEXT_INDEXOF_TOOLTIP = "Returns the index of the first/last occurrence of the first text in the second text. Returns 0 if text is not found.";
+Blockly.Msg.TEXT_ISEMPTY_HELPURL = "https://github.com/google/blockly/wiki/Text#checking-for-empty-text";
+Blockly.Msg.TEXT_ISEMPTY_TITLE = "%1 is empty";
+Blockly.Msg.TEXT_ISEMPTY_TOOLTIP = "Returns true if the provided text is empty.";
+Blockly.Msg.TEXT_JOIN_HELPURL = "https://github.com/google/blockly/wiki/Text#text-creation";
+Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH = "create text with";
+Blockly.Msg.TEXT_JOIN_TOOLTIP = "Create a piece of text by joining together any number of items.";
+Blockly.Msg.TEXT_LENGTH_HELPURL = "https://github.com/google/blockly/wiki/Text#text-modification";
+Blockly.Msg.TEXT_LENGTH_TITLE = "length of %1";
+Blockly.Msg.TEXT_LENGTH_TOOLTIP = "Returns the number of letters (including spaces) in the provided text.";
+Blockly.Msg.TEXT_PRINT_HELPURL = "https://github.com/google/blockly/wiki/Text#printing-text";
+Blockly.Msg.TEXT_PRINT_TITLE = "print %1";
+Blockly.Msg.TEXT_PRINT_TOOLTIP = "Print the specified text, number or other value.";
+Blockly.Msg.TEXT_PROMPT_HELPURL = "https://github.com/google/blockly/wiki/Text#getting-input-from-the-user";
+Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER = "Prompt for user for a number.";
+Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT = "Prompt for user for some text.";
+Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER = "prompt for number with message";
+Blockly.Msg.TEXT_PROMPT_TYPE_TEXT = "prompt for text with message";
+Blockly.Msg.TEXT_TEXT_HELPURL = "https://en.wikipedia.org/wiki/String_(computer_science)";
+Blockly.Msg.TEXT_TEXT_TOOLTIP = "A letter, word, or line of text.";
+Blockly.Msg.TEXT_TRIM_HELPURL = "https://github.com/google/blockly/wiki/Text#trimming-removing-spaces";
+Blockly.Msg.TEXT_TRIM_OPERATOR_BOTH = "trim spaces from both sides of";
+Blockly.Msg.TEXT_TRIM_OPERATOR_LEFT = "trim spaces from left side of";
+Blockly.Msg.TEXT_TRIM_OPERATOR_RIGHT = "trim spaces from right side of";
+Blockly.Msg.TEXT_TRIM_TOOLTIP = "Return a copy of the text with spaces removed from one or both ends.";
+Blockly.Msg.TODAY = "Today";
+Blockly.Msg.UNDO = "Undo";
+Blockly.Msg.VARIABLES_DEFAULT_NAME = "item";
+Blockly.Msg.VARIABLES_GET_CREATE_SET = "Create 'set %1'";
+Blockly.Msg.VARIABLES_GET_HELPURL = "https://github.com/google/blockly/wiki/Variables#get";
+Blockly.Msg.VARIABLES_GET_TOOLTIP = "Returns the value of this variable.";
+Blockly.Msg.VARIABLES_SET = "set %1 to %2";
+Blockly.Msg.VARIABLES_SET_CREATE_GET = "Create 'get %1'";
+Blockly.Msg.VARIABLES_SET_HELPURL = "https://github.com/google/blockly/wiki/Variables#set";
+Blockly.Msg.VARIABLES_SET_TOOLTIP = "Sets this variable to be equal to the input.";
+Blockly.Msg.PROCEDURES_DEFRETURN_TITLE = Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE;
+Blockly.Msg.CONTROLS_IF_IF_TITLE_IF = Blockly.Msg.CONTROLS_IF_MSG_IF;
+Blockly.Msg.CONTROLS_WHILEUNTIL_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
+Blockly.Msg.CONTROLS_IF_MSG_THEN = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
+Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
+Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE = Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE;
+Blockly.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
+Blockly.Msg.LISTS_GET_INDEX_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
+Blockly.Msg.MATH_CHANGE_TITLE_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME;
+Blockly.Msg.PROCEDURES_DEFRETURN_DO = Blockly.Msg.PROCEDURES_DEFNORETURN_DO;
+Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF = Blockly.Msg.CONTROLS_IF_MSG_ELSEIF;
+Blockly.Msg.LISTS_GET_INDEX_HELPURL = Blockly.Msg.LISTS_INDEX_OF_HELPURL;
+Blockly.Msg.CONTROLS_FOREACH_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
+Blockly.Msg.LISTS_SET_INDEX_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
+Blockly.Msg.CONTROLS_FOR_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
+Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE = Blockly.Msg.VARIABLES_DEFAULT_NAME;
+Blockly.Msg.TEXT_APPEND_VARIABLE = Blockly.Msg.VARIABLES_DEFAULT_NAME;
+Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME;
+Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
+Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT = Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT;

+ 217 - 0
index.html

@@ -0,0 +1,217 @@
+<!DOCTYPE html>
+<html>
+	<head>
+        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+        <script src="jquery-2.1.4.min.js"></script>
+		<script src="bootstrap.min.js"></script>
+
+	    <!-- Blockly core imports -->
+		<script src="blockly_compressed.js"></script>
+		<script src="blocks_compressed.js"></script>
+		<script src="en.js"></script>
+
+		<!-- R2RML Blockly -->
+		<script src="r2rml.js"></script>
+		<script src="r2rml_generator.js"></script>
+		
+		<link rel="stylesheet" type="text/css" href="bootstrap-theme.min.css">
+		<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
+
+		<style type="text/css">
+			.hideInput {
+				display: none;
+			}
+
+			.wow {font-style: italic;}
+
+			body .blocklyIconShape {
+				fill: #f00 ;
+			}
+		</style>
+	</head>
+	<body>
+	<ul class="nav nav-tabs" role="tablist">
+		<li role="presentation" class="active"><a href="#tab1" aria-controls="tab1" role="tab" data-toggle="tab">Mapping</a></li>
+		<li role="presentation"><a href="#tab2" aria-controls="tab2" role="tab" data-toggle="tab">R2RML-Mapping</a></li>
+	</ul>
+
+	<div class="tab-content">
+		<div role="tabpanel" class="tab-pane active" id="tab1">
+			<div class="row">
+				<br />
+				<div class="col-md-9">
+					<div class="panel panel-info">
+						<div id="blocklyDiv" style="height: calc(100vh - 290px);"></div>
+			    	</div>
+				</div>
+				<div id="edit" class="col-md-3" style="display:none;">
+					<div class="panel panel-info">
+					<div class="panel-heading">Table name or SQL query</div>
+					<div class="panel panel-info">
+						<textarea id="content" class="form-control" rows="3"></textarea>
+					</div>
+					<button id="saveLogicalTable" class="btn btn-default">OK</button>
+					</div>
+				</div>
+			</div>
+		</div>
+	
+		<div role="tabpanel" class="tab-pane" id="tab2">
+	    	<div class="row">
+			  	<br />
+				<div class="col-md-12">
+					<div class="panel panel-info">
+						<textarea id="code" class="form-control" rows="20" readonly="readonly"></textarea>
+					</div>
+				</div>
+			</div>
+	    </div>
+	</div>
+		<xml id="toolbox" style="display: none">  
+		  <category name="Templates" colour="360">
+			<block type="triplemap">
+				<value name="logicaltable">
+		    		<block type="tablesqlquery"></block>
+		    	</value>
+		    	<statement name="subjectmap">
+			    	<block type="subjectmap">
+	    				<field name="TERMMAP">TEMPLATE</field>
+			    	</block>
+			    </statement>
+				<statement name="predicateobjectmap">
+					<block type="predicateobjectmap">
+						<statement name="ppredicateobjectmap">
+							<block type="predicatemap"></block>
+						</statement>
+						<statement name="opredicateobjectmap">
+							<block type="objectmap">
+								<field name="TERMMAP">COLUMN</field>
+							</block>
+						</statement>
+					</block>
+				</statement>	
+			</block>
+			<block type="predicateobjectmap">
+				<statement name="ppredicateobjectmap">
+					<block type="predicatemap"></block>
+				</statement>
+				<statement name="opredicateobjectmap">
+					<block type="objectmap">
+						<field name="TERMMAP">COLUMN</field>
+					</block>
+				</statement>
+			</block>
+		  </category>
+		  <category name="Prefixes" colour="62">
+		    <block type="predefinedprefix"></block>
+		    <block type="prefix"></block>
+		    <block type="base"></block>
+		  </category>
+			<category name="Triple Map" colour="200">
+		    <block type="triplemap"></block>
+			  <category name="Logical Table" colour="85">
+			    <block type="tablesqlquery"></block>
+			  </category>
+			  <category name="Subject" colour="122">
+			    <block type="subjectmap">
+					<field name="TERMMAP">TEMPLATE</field>
+			    </block>
+			    <block type="class"></block>
+			    <block type="subjecttermtype"></block>
+			    <block type="subjectgraphtermap"></block>
+			  </category>
+			  <category name="Predicate Object" colour="62">		  
+				<block type="predicateobjectmap"></block>	
+				<category name="Predicate" colour="215">    
+					<block type="predicatemap"></block>
+				</category>
+			     <block type="predicatetermtype"></block>
+			    <category name="Object" colour="170">
+				    <block type="objectmap">
+				    	<field name="TERMMAP">COLUMN</field>
+				    </block>
+				 	<block type="objecttermtype">
+				  		<field name="TERMTYPE">termtypeliteral</field>
+				  	</block>
+				    <block type="objectdatatype"></block>
+				    <block type="objectlanguage"></block>
+						<block type="parenttriplesmap"></block>
+					  <block type="joincondition"></block>
+				</category>
+				<category name="Graph" colour="320">
+						<block type="predicategraphtermap"></block>
+				  </category>
+			  </category>
+		  </category>
+		</xml>
+
+		<xml id="startBlocks" style="display:none">
+			<block type="mapping" x="9" y="3">
+		    </block>
+		</xml>
+		
+		<!-- <xml id="startBlocks" style="display:none">
+			<block type="mapping" x="9" y="3">
+				<statement name="mapping">
+					<block type="prefix"></block>
+				</statement>
+				<statement name="triplesmap">
+					<block type="triplemap">
+						<statement name="logicaltable">
+							<block type="tablesqlquery"></block>
+						</statement>
+				    	<statement name="subjectmap">
+					    	<block type="subjectmap">
+					    		<field name="TERMMAP">TEMPLATE</field>
+					    	</block>
+					    </statement>
+						<statement name="predicateobjectmap">
+							<block type="predicateobjectmap">
+								<statement name="ppredicateobjectmap">
+									<block type="predicatemap"></block>
+								</statement>
+								<statement name="opredicateobjectmap">
+									<block type="objectmap">
+										<field name="TERMMAP">COLUMN</field>
+									</block>
+								</statement>
+							</block>
+						</statement>	
+	    			</block>
+	    		</statement>
+		    </block>
+		</xml> -->
+
+		<script>
+		var workspace = Blockly.inject('blocklyDiv', 
+		  {toolbox: document.getElementById('toolbox'), 
+		  	zoom:
+	         {controls: true,
+	          wheel: true,
+	          startScale: 0.8,
+	          maxScale: 3,
+	          minScale: 0.3,
+	          scaleSpeed: 1.1},
+	     		trashcan: true});
+
+		  Blockly.Xml.domToWorkspace(document.getElementById('startBlocks'), Blockly.mainWorkspace);
+
+		  function generateCode(event) {
+		  	var code = R2RML.workspaceToCode(workspace);
+		  	document.getElementById('code').value = code;
+		  }
+		  
+		  workspace.addChangeListener(generateCode);
+
+		  $('.nav-tabs a').on('click', function(event){
+				var x = $(event.target).text();         // active tab
+				if(x != 'Mapping') {
+					$('.blocklyToolboxDiv').hide();
+				} else {
+					$('.blocklyToolboxDiv').show();
+				}
+			});
+		</script>
+
+	</body>
+</html>

File diff suppressed because it is too large
+ 4 - 0
jquery-2.1.4.min.js


+ 607 - 0
r2rml.js

@@ -0,0 +1,607 @@
+'use strict';
+
+var mappingColour = 360;
+var tripleMapColour = 200;
+var mapColour = 48;
+var valueColour = 62;
+var parenttripleColour = 380;
+var tableColour = 85;
+var subjectColour = 122;
+var predicateColour = 215;
+var objectColour = 170;
+var graphColour = 320;
+var vocabs = [
+        ['rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>', 'rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>'],
+        ['rdfs: <http://www.w3.org/2000/01/rdf-schema#>', 'rdfs: <http://www.w3.org/2000/01/rdf-schema#>'], 
+        ['xsd: <http://www.w3.org/2001/XMLSchema#>', 'xsd: <http://www.w3.org/2001/XMLSchema#>'],
+        ['foaf: <http://xmlns.com/foaf/0.1/>', 'foaf: <http://xmlns.com/foaf/0.1/>']
+       ];
+var triplesmap = [];
+
+// default values
+// Blockly.HSV_SATURATION = 0.45;
+// Blockly.HSV_VALUE = 0.65;
+
+Blockly.HSV_SATURATION = 0.55;
+Blockly.HSV_VALUE = 0.65;
+
+var blockId;
+
+var tripleMap = 'TM';
+var logicalTable = 'LT';
+var subjectMap = 'SM';
+var predicateObjectMap = 'POM';
+var predicateMap = 'PM';
+var objectMap = 'OM';
+var graphMap = 'GM';
+var textClass = 'lead';
+
+var tripleMap = 'Triples Map';
+var logicalTable = 'Logical Table';
+var subjectMap = 'Subject Map';
+var predicateObjectMap = 'Predicate Object Maps';
+var predicateMap = 'Predicate Maps';
+var objectMap = 'Object Maps';
+var graphMap = 'Graph Maps';
+
+// indicate what is obligatory
+
+// colours on the conector
+
+// border colour indicating the next block
+
+// arity -- important to have it in the video or material
+
+// maybe delete term type for predicate map -- toolbox too
+
+
+// between the groups
+
+Blockly.Blocks['mapping'] = {
+    init: function() {
+    this.appendStatementInput('mapping')
+        .setCheck(['prefix'])
+        .appendField(new Blockly.FieldLabel('Prefixes', textClass));
+    this.appendStatementInput('triplesmap')
+        .setCheck('triplemap')
+        .appendField(new Blockly.FieldLabel(tripleMap, textClass));
+    this.setColour(mappingColour);
+    this.setTooltip('Creates a mapping.');
+    this.setHelpUrl('https://www.w3.org/TR/r2rml/');
+    this.setDeletable(false);
+  }
+};
+
+
+Blockly.Blocks['prefix'] = {
+    init: function() {
+    this.setColour(valueColour);
+    this.appendDummyInput('prefix')
+        .appendField('')
+        .appendField(new Blockly.FieldTextInput('insert prefix here'), 'PREFIX');
+    this.appendDummyInput('uri')
+        .appendField(new Blockly.FieldLabel(': <', textClass))
+        .appendField(new Blockly.FieldTextInput('insert uri here'), 'URI')
+		.appendField(new Blockly.FieldLabel('>', textClass));
+    this.setInputsInline(true);
+    this.setPreviousStatement(true, ['mapping','prefix']);
+    this.setNextStatement(true, ['prefix', 'base']);
+    this.setTooltip('Creates a prefix.');
+  }
+};
+
+Blockly.Blocks['base'] = {
+    init: function() {
+    this.setColour(valueColour);
+    this.appendDummyInput('base')
+        .appendField('base <')
+        .appendField(new Blockly.FieldTextInput('insert uri here'), 'URI')
+        .appendField('>');
+    this.setInputsInline(true);
+    this.setPreviousStatement(true, ['mapping','prefix']);
+    this.setNextStatement(true, 'prefix');
+    this.setTooltip('Creates a base uri.');
+  }, onchange: function() {
+    validateFields(this);
+  }
+};
+
+Blockly.Blocks['predefinedprefix'] = {
+    init: function() {
+    this.setColour(valueColour);
+    this.appendDummyInput('prefix')
+        .appendField('')
+        .appendField(new Blockly.FieldDropdown(vocabs), 'PREFIX');
+    this.setInputsInline(true);
+    this.setPreviousStatement(true, ['mapping','prefix']);
+    this.setNextStatement(true, 'prefix');
+    this.setTooltip('Creates a prefix.');
+  }
+};
+
+
+Blockly.Blocks['tablesqlquery'] = {
+    init: function() {
+    if(this.sql != undefined){
+    sqlFromDatabase = this.sql.substring(0,20) + (this.sql.length > 20 ? '...' : '')    
+  }
+    this.setColour(tableColour);
+    this.appendDummyInput('tablesqlquery')
+        .appendField(new Blockly.FieldDropdown([['table', 'table'], ['sql query', 'sqlquery']]), 'TABLESQLQUERY')
+        .appendField(new Blockly.FieldLabel('click here to insert value',''), 'sql'); 
+    this.setInputsInline(true);
+    this.setPreviousStatement(true, ['logicaltable','tablesqlquery']);
+    this.setTooltip('Defines a table or sql query.');
+    this.setHelpUrl('https://www.w3.org/ns/r2rml#logicalTable');
+    this.sql = "click here to insert";
+  },
+  mutationToDom: function() {
+    var container = document.createElement('mutation');
+    container.setAttribute('sql', this.sql);
+    return container;
+  },
+  domToMutation: function(xmlElement) {
+    this.sql = xmlElement.getAttribute('sql');
+  this.setFieldValue(this.sql.substring(0,20) + (this.sql.length > 20 ? '...' : ''), 'sql');;
+  },
+  onchange: function(ev) {
+    blockId = ev.blockId;
+    var block = workspace.getBlockById(blockId);
+    if(block != undefined && block.type == 'tablesqlquery'){
+      $('#content').val(block.sql); 
+      $('#edit').show();  
+      $('#edit div textarea').focus();  
+      $('#edit div textarea').select(); 
+    } else {
+    $('#edit').hide();  
+    }
+  }
+};
+
+$(document).ready(function() {
+  $("#saveLogicalTable").bind( "click", function() {
+    var block = workspace.getBlockById(blockId);
+    if(block){
+      var content = $('#content').val();
+      block.sql = content;
+      block.setFieldValue(content.substring(0,20) + (content.length > 20 ? '...' : ''), 'sql');
+      blockId = undefined;
+      $('#edit').hide();
+    }
+  });
+});
+
+Blockly.Blocks['class'] = {
+    init: function() {
+    this.setColour(subjectColour);
+    this.appendDummyInput('class')
+        .appendField('Class:')
+        .appendField(new Blockly.FieldTextInput('class'), 'CLASS');
+    this.setInputsInline(true);
+    this.setPreviousStatement(true, ['class', 'subjecttermtype']);
+    this.setNextStatement(true, ['class', 'subjecttermtype']);
+    this.setTooltip('Defines a class.');
+    this.setHelpUrl('https://www.w3.org/ns/r2rml#class');
+  }
+};
+
+function nextTripleMapName() {
+  var blocks = getBlocksByType('triplemap');
+  return 'TripleMap' + (blocks.length + 1);
+}
+
+Blockly.Blocks['triplemap'] = {
+  init: function() {
+    this.appendDummyInput('triple-map')
+        .appendField('<#')
+        .appendField(new Blockly.FieldTextInput(nextTripleMapName()), 'TRIPLEMAPNAME')
+        .appendField('>');
+    this.appendStatementInput('logicaltable')
+        .setCheck(['tablesqlquery'])
+        .appendField(new Blockly.FieldLabel(logicalTable, textClass));
+    this.appendStatementInput('subjectmap')
+        .setCheck(['subjectmap'])
+        .appendField(new Blockly.FieldLabel(subjectMap, textClass));
+    this.appendStatementInput('predicateobjectmap')
+        .setCheck('predicateobjectmap')
+        .appendField(new Blockly.FieldLabel(predicateObjectMap, textClass));
+    this.setColour(tripleMapColour);
+    this.setPreviousStatement(true, ['triplemap']);
+    this.setNextStatement(true, 'triplemap');
+    this.setTooltip('Creates a triple map.');
+    this.setHelpUrl('https://www.w3.org/ns/r2rml#TriplesMap');
+  }, onchange: function(ev) {
+  	var MSG_UNIQUE_TRIPLE_MAP = 'Triples map names must be unique!';
+  	var MSG_LOGICAL_TABLE_SUBJECT_MAP = 'A triple map must have one logical table and one subject map!';
+	if(this.getInputTargetBlock('logicaltable') == null || this.getInputTargetBlock('subjectmap') == null) {
+	    this.setWarningText(MSG_LOGICAL_TABLE_SUBJECT_MAP);
+	} else {
+	    this.setWarningText(null);
+	}
+
+    var abort = false;
+    if(ev.type == Blockly.Events.CHANGE || ev.type == Blockly.Events.MOVE) {
+      var blocks = getBlocksByType('triplemap');
+      for(var i = 0; i < blocks.length && !abort; i++) {
+        for(var j = 0; j < blocks.length && !abort; j++) {
+          var oneBlock = blocks[i];
+          var anotherBlock = blocks[j];
+          if(oneBlock.id != anotherBlock.id && oneBlock.getFieldValue('TRIPLEMAPNAME') == anotherBlock.getFieldValue('TRIPLEMAPNAME')) {
+            abort = true;
+            alert(MSG_UNIQUE_TRIPLE_MAP);
+            this.setFieldValue(nextTripleMapName(), 'TRIPLEMAPNAME');
+          }
+        }
+      }
+
+      var blocks = getBlocksByType('parenttriplesmap');
+      for(var i = 0; i < blocks.length; i++) {
+        if(ev.name == 'TRIPLEMAPNAME' && ev.oldValue == blocks[i].getFieldValue('PARENTTRIPLEMAP')){
+          blocks[i].setFieldValue(ev.newValue, 'PARENTTRIPLEMAP');
+          break;
+        }
+      }
+    }
+
+  }
+};
+
+Blockly.Blocks['subjectmap'] = {
+    init: function() {
+    this.appendStatementInput('termmap')
+        .appendField(new Blockly.FieldDropdown([['constant', 'CONSTANT'], ['column', 'COLUMN'], ['template', 'TEMPLATE']]), 'TERMMAP')
+        .appendField(new Blockly.FieldTextInput('insert value'), 'TERMMAPVALUE')
+        .setCheck(['subjecttermtype', 'subjecttermmap', 'class'])
+        .appendField('');
+    this.setColour(subjectColour);
+    this.setPreviousStatement(true, ['subjectmap']);
+    this.setTooltip('Defines the subject.');
+    this.setHelpUrl('https://www.w3.org/ns/r2rml#SubjectMap');
+  }, onchange: function() {
+    validateFields(this);
+    if(this.getFieldValue('TERMMAP') == 'EMPTY') {
+      this.setFieldValue('', 'TERMMAPVALUE');
+      Blockly.addClass_(this.getField('TERMMAPVALUE').fieldGroup_, 'hideInput');
+    } else {
+      Blockly.removeClass_(this.getField('TERMMAPVALUE').fieldGroup_, 'hideInput');
+    }
+  }
+};
+
+Blockly.Blocks['predicateobjectmap'] = {
+    init: function() {
+    this.appendStatementInput('ppredicateobjectmap')
+        .setCheck(['predicatemap'])
+        .appendField(new Blockly.FieldLabel(predicateMap, textClass));
+    this.appendStatementInput('opredicateobjectmap')
+        .setCheck(['objectmap', 'parenttriplesmap'])
+        .appendField(new Blockly.FieldLabel(objectMap, textClass));
+    this.appendStatementInput('graphmap')
+        .setCheck(['predicategraphtermap'])
+        .appendField(new Blockly.FieldLabel(graphMap, textClass));
+    this.setColour(mapColour);
+    this.setPreviousStatement(true, [ 'predicateobjectmap']);
+    this.setNextStatement(true, ['predicateobjectmap']);
+    this.setTooltip('Creates a predicate object map.');
+    this.setHelpUrl('https://www.w3.org/ns/r2rml#PredicateObjectMap');
+  }, onchange: function(ev){
+  	if(this.getInputTargetBlock('ppredicateobjectmap') == null || this.getInputTargetBlock('opredicateobjectmap') == null) {
+  		this.setWarningText('A predicate object map must have at least one predicate map and one object map!');
+  	} else {
+  		this.setWarningText(null);
+  	}
+  }
+};
+
+Blockly.Blocks['predicatemap'] = {
+    init: function() {
+    this.appendDummyInput('termmap')
+        .appendField(new Blockly.FieldDropdown([['constant', 'CONSTANT'], ['column', 'COLUMN'], ['template', 'TEMPLATE']]), 'TERMMAP')
+        .appendField(new Blockly.FieldTextInput('insert value'), 'TERMMAPVALUE');
+    this.setColour(predicateColour);
+    this.setPreviousStatement(true, ['predicatemap']);
+    this.setNextStatement(true, ['predicatemap']);
+    this.setTooltip('Creates a predicate map.');
+    this.setHelpUrl('http://www.w3.org/ns/r2rml#PredicateMap');
+  }, onchange: function() {
+    validateFields(this);
+  }
+};
+
+Blockly.Blocks['objectmap'] = {
+    init: function() {
+    this.appendStatementInput('termmap')
+        .appendField(new Blockly.FieldDropdown([['constant', 'CONSTANT'], ['column', 'COLUMN'], ['template', 'TEMPLATE']]), 'TERMMAP')
+        .appendField(new Blockly.FieldTextInput('insert value'), 'TERMMAPVALUE')
+        .setCheck(['objecttermmap', 'language', 'datatype', 'objecttermtype'])
+        .appendField('');
+    this.setColour(objectColour);
+    this.setPreviousStatement(true, ['objectmap']);
+    this.setNextStatement(true, ['objectmap']);
+    this.setTooltip('Creates an object map.');
+    this.setHelpUrl('http://www.w3.org/ns/r2rml#ObjectMap');
+  }, onchange: function() {
+    validateFields(this);
+  }
+};
+
+function validateFields(block) {
+  if(block.getDescendants() != undefined){
+       var descendants = block.getDescendants();
+       var typesToValidate = {'datatype': 'datatype', 'language': 'language', 'base': 'base uri',
+                              'subjecttermmap': 'term map', 'predicatetermmap': 'term map', 
+                              'objecttermmap': 'term map', 'subjecttermtype': 'term map', 
+                              'predicatetermtype': 'term map', 'objecttermtype': 'term map', 'inverseexpression': 'inverse expression'};
+       var hashmap = {};
+       for(var key in typesToValidate) {
+          hashmap[key] = 0;
+       }
+
+       for(var i = 0; i < descendants.length; i++) {
+          var descendant = descendants[i];
+          var type = descendant.type;
+          if(type in hashmap) {
+              hashmap[type] += 1;
+              if(hashmap[type] > 1) {
+                alert('Only one ' + typesToValidate[type]  + ' permited!');
+                if(descendant.getChildren() != undefined && descendant.getChildren().length != 0){
+                  var blockChildId = descendant.getChildren()[0].id;
+                  var parent = descendant.getParent();
+                  descendant.getChildren()[0].unplug();
+                  var blockChild = workspace.getBlockById(blockChildId);
+                  parent.nextConnection.connect(blockChild.previousConnection);
+                }
+                descendant.dispose();
+                break;
+            }
+          }
+       }
+    }
+}
+
+// subject term map
+Blockly.Blocks['subjecttermtype'] = {
+    init: function() {
+    this.appendDummyInput('termtype')
+        .appendField('Term type')
+        .appendField(new Blockly.FieldDropdown([['iri', 'termtypeiri'], ['blank node', 'termtypeblanknode']]), 'TERMTYPE');
+    this.setColour(subjectColour);
+    this.setPreviousStatement(true, ['subjecttermtype', 'class']);
+    this.setNextStatement(true, ['subjecttermtype', 'termtypesubject', 'class']);
+    this.setTooltip('Defines a term type.');
+    this.setHelpUrl('https://www.w3.org/ns/r2rml#termType');
+  }
+};
+
+//predicate term map
+Blockly.Blocks['predicatetermtype'] = {
+    init: function() {
+    this.appendDummyInput('termtype')
+        .appendField('Term type')
+        .appendField(new Blockly.FieldDropdown([['iri', 'termtypeiri']]), 'TERMTYPE');
+    this.setColour(predicateColour);
+    this.setPreviousStatement(true, ['predicatetermmap']);
+    // this.setNextStatement(true, ['predicatetermtype', 'predicatetermmap']); // TODO review this
+    this.setTooltip('Defines a term type.');
+    this.setHelpUrl('https://www.w3.org/ns/r2rml#termType');
+  }
+};
+
+//object term map
+Blockly.Blocks['subjectgraphtermap'] = {
+    init: function() {
+    this.setColour(subjectColour);
+    this.appendDummyInput('graphtermap')
+      .appendField('Subject graph map:')
+      .appendField(new Blockly.FieldDropdown([['constant', 'CONSTANT'], ['column', 'COLUMN'], ['template', 'TEMPLATE']]), 'TERMMAP')
+      .appendField(new Blockly.FieldTextInput('insert value'), 'TERMMAPVALUE');
+    this.setInputsInline(true);
+    this.setPreviousStatement(true, ['class', 'subjecttermtype']);
+    this.setNextStatement(true, ['class', 'subjecttermtype']);
+    this.setTooltip('Defines a graph map.');
+    this.setHelpUrl('http://www.w3.org/ns/r2rml#GraphMap');
+  } 
+};
+
+Blockly.Blocks['predicategraphtermap'] = {
+    init: function() {
+    this.setColour(graphColour);
+    this.appendDummyInput('graphtermap')
+      .appendField('Predicate object graph map:')
+        .appendField(new Blockly.FieldDropdown([['constant', 'CONSTANT'], ['column', 'COLUMN'], ['template', 'TEMPLATE']]), 'TERMMAP')
+        .appendField(new Blockly.FieldTextInput('insert value'), 'TERMMAPVALUE');
+    this.setInputsInline(true);
+    this.setPreviousStatement(true, ['predicategraphtermap']);
+    this.setNextStatement(true, ['predicategraphtermap']);
+    this.setTooltip('Defines a graph map.');
+    this.setHelpUrl('http://www.w3.org/ns/r2rml#GraphMap');
+  } 
+};
+
+Blockly.Blocks['language'] = {
+    init: function() {
+    this.setColour(objectColour);
+    this.appendDummyInput('language')
+        .appendField('Language:')
+        .appendField(new Blockly.FieldTextInput('insert language here'), 'LANGUAGE');
+    this.setInputsInline(true);
+    this.setPreviousStatement(true, ['language', 'datatype', 'language', 'objecttermtype', 'inverseexpression', 'objecttermmap']);
+    this.setNextStatement(true, ['language', 'datatype', 'objecttermtype', 'inverseexpression', 'objecttermmap']); 
+    this.setTooltip('Defines a language.');
+    this.setHelpUrl('https://www.w3.org/ns/r2rml#language');
+  }
+};
+
+
+Blockly.Blocks['datatype'] = {
+    init: function() {
+    this.setColour(objectColour);
+    this.appendDummyInput('datatype')
+        .appendField('Datatype')
+        .appendField(new Blockly.FieldTextInput('insert datatype here'), 'DATATYPE');
+    this.setInputsInline(true);
+    this.setPreviousStatement(true, ['datatype', 'language', 'objecttermtype', 'inverseexpression', 'objecttermmap']);
+    this.setNextStatement(true, ['language', 'datatype', 'objecttermtype', 'inverseexpression', 'objecttermmap']); 
+    this.setTooltip('Defines a datatype.');
+    this.setHelpUrl('https://www.w3.org/ns/r2rml#datatype');
+  }
+};
+
+Blockly.Blocks['inverseexpression'] = {
+    init: function() {
+    this.setColour(objectColour);
+    this.appendDummyInput('inverseexpression')
+        .appendField('Inverse Expression:')
+        .appendField(new Blockly.FieldTextInput('insert inverse expression here'), 'INVERSEEXPRESSION');
+    this.setInputsInline(true);
+    this.setPreviousStatement(true, ['inverseexpression', 'language', 'datatype', 'objecttermtype', 'objecttermmap']);
+    this.setNextStatement(true, ['language', 'datatype', 'objecttermtype', 'inverseexpression', 'objecttermmap']); 
+    this.setTooltip('Defines an inverse expression.');
+    this.setHelpUrl('http://www.w3.org/ns/r2rml#inverseExpression');
+  }
+};
+
+
+function loadTripleMaps() {
+  var options = [['select a triple map','']];
+  var blocks = getBlocksByType('triplemap');
+  for (var i = 0; i < blocks.length; i++) {
+      options.push([blocks[i].getFieldValue('TRIPLEMAPNAME'), blocks[i].getFieldValue('TRIPLEMAPNAME')]);
+  }
+  return options;
+}
+
+Blockly.Blocks['parenttriplesmap'] = {
+    init: function() {
+    this.appendDummyInput('parenttriplemap')
+        .appendField(new Blockly.FieldDropdown(loadTripleMaps), 'PARENTTRIPLEMAP');
+    this.appendStatementInput('joincondition')
+        .setCheck(['joincondition'])
+        .appendField('Join Condition');
+    this.setColour(parenttripleColour);
+    this.setPreviousStatement(true, ['objectmap', 'parenttriplesmap']);
+    this.setNextStatement(true, ['objectmap', 'parenttriplesmap']);
+    this.setTooltip('Creates a parent triple map.');
+    this.setHelpUrl('http://www.w3.org/ns/r2rml#parentTriplesMap');
+  }
+  , onchange: function(ev){
+    if(this.getParent() != undefined && getTripleMap(this) != null) {
+      var triplemapName = getTripleMap(this).getFieldValue('TRIPLEMAPNAME');
+      var parenttriplemapName = this.getFieldValue('PARENTTRIPLEMAP');
+      if(triplemapName == parenttriplemapName) {
+        alert('Not possible to create a parent triple map with the same triple map!');
+        this.setFieldValue(0, 'PARENTTRIPLEMAP');
+      }
+    }
+  }
+};
+
+function getTripleMap(thisBlock){
+  if(thisBlock.getParent() == null){
+    return null;
+  }
+  if(thisBlock.type == 'triplemap') {
+    return thisBlock;
+  }
+  return getTripleMap(thisBlock.getParent());
+}
+
+Blockly.Blocks['joincondition'] = {
+    init: function() {
+    this.setColour(parenttripleColour);
+    this.appendDummyInput('joinconditionchild')
+        .appendField('Child:')
+        .appendField(new Blockly.FieldTextInput('insert value here'), 'CHILD');
+    this.appendDummyInput('joinconditionparent')
+        .appendField('Parent:')
+        .appendField(new Blockly.FieldTextInput('insert value here'), 'PARENT');
+    this.setPreviousStatement(true, ['joincondition']);
+    this.setNextStatement(true, ['joincondition']);
+    this.setTooltip('Defines a join condition.');
+    this.setHelpUrl('http://www.w3.org/ns/r2rml#joinCondition');
+  }
+};
+
+Blockly.Blocks['objecttermtype'] = {
+  init: function() {
+    this.setColour(objectColour);
+    this.appendDummyInput("termtype")
+        .appendField("Term type")
+        .appendField(new Blockly.FieldDropdown([ ['iri', 'termtypeiri'], ['literal', 'termtypeliteral'], ['blank node', 'termtypeblanknode']]), 'TERMTYPE');
+    this.appendValueInput("termtypevalue")
+        .appendField("as/in")
+        .setCheck(["objectdatatype", "objectlanguage"]);
+    this.setPreviousStatement(true, ['objecttermmap']);
+    this.setInputsInline(true);
+    this.setTooltip('Defines a literal.');
+    this.setHelpUrl('http://www.w3.org/ns/r2rml#termType');
+  }, onchange: function() {
+    if(this.getFieldValue('TERMTYPE') == 'termtypeliteral') {
+    	this.getInput('termtypevalue').setVisible(true);
+    } else {
+    	this.getInput('termtypevalue').setVisible(false);
+  	}
+  	this.render();
+  }
+};
+
+
+Blockly.Blocks['objectdatatype'] = {
+  init: function() {
+    this.setColour(objectColour);
+    this.appendDummyInput()
+        .appendField("datatype")
+        .appendField(new Blockly.FieldTextInput("insert datatype here"), "DATATYPE");
+    this.setOutput(true, null);
+    this.setTooltip('Defines a datatype.');
+    this.setHelpUrl('https://www.w3.org/ns/r2rml#datatype');
+  }
+};
+
+Blockly.Blocks['objectlanguage'] = {
+  init: function() {
+    this.setColour(objectColour);
+    this.appendDummyInput()
+        .appendField("language")
+        .appendField(new Blockly.FieldTextInput("insert language here"), "LANGUAGE");
+    this.setOutput(true, null);
+    this.setTooltip('Defines a language.');
+    this.setHelpUrl('https://www.w3.org/ns/r2rml#language');
+  }
+};
+
+// Utils
+
+//************************************
+//find all blocks on workspace by type
+//************************************
+function getBlocksByType(type) {
+  var blocks = [];
+  for (var blockID in workspace.blockDB_) {
+    if (workspace.blockDB_[blockID].type == type) {
+      blocks.push(workspace.blockDB_[blockID]);
+    }
+  }
+  return(blocks);
+}
+
+function isAnyDisconnected() {
+  for (var blockID in workspace.blockDB_) {
+    if (workspace.blockDB_[blockID].type != 'mapping' && workspace.blockDB_[blockID].getParent() == undefined) {
+      return true;
+    }
+  }
+  return false;
+}
+
+/*
+export
+var xml = Blockly.Xml.workspaceToDom(workspace);
+var xml_text = Blockly.Xml.domToText(xml);
+
+
+import
+var xml = Blockly.Xml.textToDom(xml_text);
+Blockly.Xml.domToWorkspace(xml, workspace);
+
+*/

+ 357 - 0
r2rml_generator.js

@@ -0,0 +1,357 @@
+'use strict';
+
+var R2RML = new Blockly.Generator('R2RML');
+/**
+ * List of illegal variable names.
+ * This is not intended to be a security feature.  Blockly is 100% client-side,
+ * so bypassing this list is trivial.  This is intended to prevent users from
+ * accidentally clobbering a built-in object or function.
+ * @private
+ */
+R2RML.addReservedWords('');
+// R2RML.EXAMPLE = "###\n";
+
+/**
+ * Initialise the database of variable names.
+ * @param {!Blockly.Workspace} workspace Workspace to generate code from.
+ */
+R2RML.init = function(workspace) {
+};
+
+/**
+ * Prepend the generated code with the variable definitions.
+ * @param {string} code Generated code.
+ * @return {string} Completed code.
+ */
+R2RML.finish = function(code) {
+  return code;
+};
+
+/**
+ * Naked values are top-level blocks with outputs that aren't plugged into
+ * anything.  A trailing semicolon is needed to make this legal.
+ * @param {string} line Line of generated code.
+ * @return {string} Legal line of code.
+ */
+R2RML.scrubNakedValue = function(line) {
+  return line + ';\n';
+};
+
+/**
+ * Encode a string as a properly escaped R2RML string, complete with
+ * quotes.
+ * @param {string} string Text to encode.
+ * @return {string} R2RML string.
+ * @private
+ */
+R2RML.quote_ = function(string) {
+  // TODO: This is a quick hack.  Replace with goog.string.quote
+  string = string.replace(/\\/g, '\\\\')
+                 .replace(/\n/g, '\\\n')
+                 .replace(/'/g, '\\\'');
+  return '\'' + string + '\'';
+};
+
+/**
+ * Common tasks for generating R2RML from blocks.
+ * Handles comments for the specified block and any connected value blocks.
+ * Calls any statements following this block.
+ * @param {!Blockly.Block} block The current block.
+ * @param {string} code The R2RML code created for this block.
+ * @return {string} R2RML code with comments and subsequent blocks added.
+ * @private
+ */
+R2RML.scrub_ = function(block, code) {
+  var commentCode = '';
+  // Only collect comments for blocks that aren't inline.
+  if (!block.outputConnection || !block.outputConnection.targetConnection) {
+    // Collect comment for this block.
+    var comment = block.getCommentText();
+    if (comment) {
+      commentCode += R2RML.prefixLines(comment, '// ') + '\n';
+    }
+    // Collect comments for all value arguments.
+    // Don't collect comments for nested statements.
+    for (var x = 0; x < block.inputList.length; x++) {
+      if (block.inputList[x].type == Blockly.INPUT_VALUE) {
+        var childBlock = block.inputList[x].connection.targetBlock();
+        if (childBlock) {
+          var childComment = R2RML.allNestedComments(childBlock);
+          if (childComment) {
+            commentCode += R2RML.prefixLines(childComment, '// ');
+          }
+        }
+      }
+    }
+  }
+  var nextBlock = block.nextConnection && block.nextConnection.targetBlock();
+  var nextCode = R2RML.blockToCode(nextBlock);
+  return commentCode + code + nextCode;
+};
+
+function isDisconnected(block) {
+  return block.getParent() == undefined;
+}
+
+R2RML.mapping = function(block) {
+  if (!block) {
+    return '';
+  }
+  var mapping = '# Mapping created using R2RML editor. \n  @prefix rr: <http://www.w3.org/ns/r2rml#> . \n'; 
+  mapping +=  R2RML.statementToCode(block, 'mapping');
+  mapping +=  "\n" + R2RML.statementToCode(block, 'triplesmap');
+  return mapping;
+};
+
+R2RML.prefix = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+  
+  var prefix = block.getFieldValue('PREFIX');
+  var uri = block.getFieldValue('URI');
+  return "@prefix "+ prefix +": <" + uri + "> .\n";
+};
+
+R2RML.base = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+  
+  var uri = block.getFieldValue('URI');
+  return "@base <" + uri + "> .\n";
+};
+
+R2RML.predefinedprefix = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+  
+  var prefix = block.getFieldValue('PREFIX');
+  return "@prefix "+ prefix +" .\n";
+};
+
+R2RML.triplemap = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  // countTripleMap++;
+  var triplemap = block.getFieldValue('TRIPLEMAPNAME'); //"TripleMap" + countTripleMap;
+  return "<#" + triplemap + ">\n" + "rr:logicalTable [ " + R2RML.statementToCode(block, 'logicaltable') + "];"  
+              + "\n " + R2RML.statementToCode(block, 'subjectmap')
+              + "\n " + R2RML.statementToCode(block, 'predicateobjectmap')  + " . \n\n"; 
+};
+
+R2RML.tablesqlquery = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  var isTable = block.getFieldValue('TABLESQLQUERY') == 'table';
+  var separator = (isTable ? '\"' : '\"\"\"');
+  var table = (isTable ? 'rr:tableName ' : 'rr:sqlQuery ');
+  return "\n" + table + separator + block.sql + separator + ";\n";
+};
+
+R2RML.subjectmap = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:subjectMap [ \n  " + termmap(block) + R2RML.statementToCode(block, 'termmap') + "]; \n";
+};
+
+R2RML.class = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:class " + block.getFieldValue('CLASS') + ";\n";
+};
+
+R2RML.predicateobjectmap = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:predicateObjectMap [ \n" + R2RML.statementToCode(block, 'ppredicateobjectmap') + 
+                                  "\n " + R2RML.statementToCode(block, 'opredicateobjectmap') +
+                                  "\n " + R2RML.statementToCode(block, 'graphmap') + "]; \n";
+};
+
+R2RML.objectmap = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:objectMap [ \n  " + termmap(block) +  R2RML.statementToCode(block, 'termmap')  + "]; \n";
+};
+
+R2RML.predicatemap = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:predicateMap [ \n  " + termmap(block) + R2RML.statementToCode(block, 'termmap')  + "]; \n";
+};
+
+R2RML.object = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:object " + block.getFieldValue('OBJECT') + ";\n";
+};
+
+R2RML.predicate = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:predicate " + block.getFieldValue('PREDICATE') + ";\n";
+};
+
+R2RML.inverseexpression = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:inverseExpression \"" + block.getFieldValue('INVERSEEXPRESSION') + "\";\n";
+};
+
+R2RML.datatype = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:datatype " + block.getFieldValue('DATATYPE') + ";\n";
+};
+
+R2RML.objectdatatype = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:datatype " + block.getFieldValue('DATATYPE') + ";\n";
+};
+
+
+R2RML.language = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:language \"" + block.getFieldValue('LANGUAGE') + "\";\n";
+};
+
+R2RML.objectlanguage = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:language \"" + block.getFieldValue('LANGUAGE') + "\";\n";
+};
+
+R2RML.joincondition = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:joinCondition [ \n   rr:child \"" + block.getFieldValue('CHILD') + "\";\n   rr:parent \"" + block.getFieldValue('PARENT') + "\";\n];\n";
+};
+
+R2RML.parenttriplesmap = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  var triplesmap = block.getFieldValue('PARENTTRIPLEMAP');
+  return "rr:objectMap [\n  rr:parentTriplesMap <#" + triplesmap + ">;\n" + R2RML.statementToCode(block, 'joincondition') + "];"; 
+};
+
+function termtype(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  var code = "rr:termType ";
+  var termtype = block.getFieldValue('TERMTYPE');
+  if(termtype == 'termtypeiri'){
+    code += 'rr:IRI; \n';
+  } else if(termtype == 'termtypeblanknode'){
+    code += 'rr:BlankNode; \n';
+  } else {
+    code += 'rr:Literal; \n';
+    if(block.type == 'objecttermtype'){
+      code += R2RML.statementToCode(block, 'termtypevalue');
+    }
+  }
+  return code;
+}
+
+R2RML.subjectgraphtermap = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:graphMap [\n\t" + termmap(block) + "];\n";
+};
+
+R2RML.predicategraphtermap = function(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  return "rr:graphMap [\n\t" + termmap(block) + "];\n";
+};
+
+function termmap(block) {
+  if (isDisconnected(block)) {
+    return '';
+  }
+
+  var code = "";
+  var termmap = block.getFieldValue('TERMMAP');
+  if(termmap == 'CONSTANT'){
+    code += 'rr:constant';
+    code += ' ' + block.getFieldValue('TERMMAPVALUE') + ";\n";
+  } else if(termmap == 'TEMPLATE'){
+    code += 'rr:template';
+    code += " \"" + block.getFieldValue('TERMMAPVALUE') + "\";\n";
+  } else if (termmap == 'COLUMN'){
+    code += 'rr:column';
+    code += " \"" + block.getFieldValue('TERMMAPVALUE') + "\";\n";
+  } 
+
+  if(block.type == 'predicatemap'){
+    code += '  rr:termType rr:IRI;\n';
+  }
+
+  return code;
+}
+
+R2RML.subjecttermtype = function(block) {
+  return termtype(block);
+};
+
+R2RML.subjecttermmap = function(block) {
+  return termmap(block);
+};
+
+R2RML.predicatetermtype = function(block) {
+  return termtype(block);
+};
+
+R2RML.predicatetermmap = function(block) {
+  return termmap(block);
+};
+
+R2RML.objecttermtype = function(block) {
+  return termtype(block);
+};
+
+R2RML.objecttermmap = function(block) {
+  return termmap(block);
+};
+