function genEditableConceptInfo($interface) { global $allInterfaceObjects; global $relationTableInfo; $editableConcepts = $allInterfaceObjects[$interface]['editableConcepts']; $atomViewMap = array(); foreach ($editableConcepts as $editableConcept) { $allAtoms = getAllConceptAtoms($editableConcept); $atomsAndViews = array(); foreach ($allAtoms as $atom) { $atomsAndViews[] = array('atom' => $atom, 'view' => showViewAtom($atom, $editableConcept)); } $atomViewMap[$editableConcept] = array('hasView' => getView($editableConcept) != null, 'atomViewMap' => $atomsAndViews); } $atomKeyMapJson = json_encode($atomViewMap); echo "\n\nfunction getEditableConceptInfo() {\n"; echo " return {$atomKeyMapJson};\n"; echo "}\n"; }
function showPair($srcAtom, $srcConcept, $srcNrOfIfcs, $tgtAtom, $tgtConcept, $tgtNrOfIfcs, $pairView) { $srcHasInterfaces = $srcNrOfIfcs == 0 ? '' : ' hasInterface=' . ($srcNrOfIfcs == 1 ? 'single' : 'multiple'); $tgtHasInterfaces = $tgtNrOfIfcs == 0 ? '' : ' hasInterface=' . ($tgtNrOfIfcs == 1 ? 'single' : 'multiple'); if (count($pairView) == 0) { $source = showViewAtom($srcAtom, $srcConcept); $target = showViewAtom($tgtAtom, $tgtConcept); // if source and target are the same atom and we have a view for it, don't show a tuple if ($srcAtom == $tgtAtom && $srcConcept == $tgtConcept && getView($srcConcept)) { return "<span class=\"Pair\">" . "<span class=\"PairAtom\" atom=\"{$srcAtom}\" concept=\"{$srcConcept}\"{$srcHasInterfaces}>{$source}</span>" . "</span>"; } else { return "<span class=\"Pair\">(" . "<span class=\"PairAtom\" atom=\"{$srcAtom}\" concept=\"{$srcConcept}\"{$srcHasInterfaces}>'{$source}'</span>" . ", <span class=\"PairAtom\" atom=\"{$tgtAtom}\" concept=\"{$tgtConcept}\"{$tgtHasInterfaces}>'{$target}'</span>" . ")</span>"; } } else { $pairStrs = array("<span class=\"Pair\">"); foreach ($pairView as $segment) { if ($segment['segmentType'] == 'Text') { $pairStrs[] = $segment['Text']; } else { $atom = $segment['srcOrTgt'] == 'Src' ? $srcAtom : $tgtAtom; $concept = $segment['srcOrTgt'] == 'Src' ? $srcConcept : $tgtConcept; $hasInterfaces = $segment['srcOrTgt'] == 'Src' ? $srcHasInterfaces : $tgtHasInterfaces; $r = getCoDomainAtoms($atom, $segment['expSQL']); // we label all expressionsegments as violation source or target based on the source of their expression $pairStrs[] = "<span class=\"PairAtom\" atom=\"{$atom}\" concept=\"{$concept}\"{$hasInterfaces}>"; $pairStrs[] = showViewAtom($r[0], $segment['expTgt']) . "</span>"; } } $pairStrs[] = "</span>"; return implode($pairStrs); } }