# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash

B=`basename $0 .sh`
cd `dirname $0`
source ./rungraphd

#  A toplevel node in a constraint doesn't have a key.
#  Its subconstraint has a key.  The link between the two
#  is not part of the key.
#
#  Writing that subconstraint used to a trigger an assertion failure.

rm -rf $D
rungraphd -d${D}  -bty <<- 'EOF'
restore ("5" 0 72
(0100007f4000723a8000000000000000 null null null null 0 true true 2006-02-07T20:24:08.0000 0 0 0)
(0100007f4000723a8000000000000001 null null null null 0 true true 2006-02-07T20:24:09.0000 0 0 0)
(0100007f4000723a8000000000000002 null null null null 0 true true 2006-02-07T20:24:09.0001 0 0 0)
(0100007f4000723a8000000000000003 null null null null 0 true true 2006-02-07T20:24:09.0002 0 0 0)
(0100007f4000723a8000000000000004 null null null null 0 true true 2006-02-07T20:24:09.0003 0 0 0)
(0100007f4000723a8000000000000005 null null null null 0 true true 2006-02-07T20:24:09.0004 0 0 0)
(0100007f4000723a8000000000000006 null null null null 0 true true 2006-02-07T20:24:10.0000 0 0 0)
(0100007f4000723a8000000000000007 null null null null 0 true true 2006-02-07T20:24:10.0001 0 0 0)
(0100007f4000723a8000000000000008 null null null null 0 true true 2006-02-07T20:24:10.0002 0 0 0)
(0100007f4000723a8000000000000009 null null null null 0 true true 2006-02-07T20:24:10.0003 0 0 0)
(0100007f4000723a800000000000000a 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:10.0004 0100007f4000723a8000000000000000 0100007f4000723a8000000000000009 0)
(0100007f4000723a800000000000000b 0100007f4000723a8000000000000001 null string "bootstrap-namespace" 0 true true 2006-02-07T20:24:11.0000 0100007f4000723a8000000000000000 0100007f4000723a8000000000000000 0)
(0100007f4000723a800000000000000c 0100007f4000723a8000000000000001 null string "bootstrap-namespace" 0 true true 2006-02-07T20:24:11.0001 0100007f4000723a8000000000000000 0100007f4000723a8000000000000007 0)
(0100007f4000723a800000000000000d 0100007f4000723a8000000000000001 "Metaweb_Bootstrap_Anchor" string "has_name" 0 true true 2006-02-07T20:24:12.0000 0100007f4000723a8000000000000001 0100007f4000723a8000000000000000 0)
(0100007f4000723a800000000000000e 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:12.0001 0100007f4000723a8000000000000001 0100007f4000723a8000000000000005 0)
(0100007f4000723a800000000000000f 0100007f4000723a8000000000000001 null string "is-instance-of" 0 true true 2006-02-07T20:24:13.0000 0100007f4000723a8000000000000002 0100007f4000723a8000000000000000 0)
(0100007f4000723a8000000000000010 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:13.0001 0100007f4000723a8000000000000002 0100007f4000723a8000000000000004 0)
(0100007f4000723a8000000000000011 0100007f4000723a8000000000000001 null string "type-type" 0 true true 2006-02-07T20:24:13.0002 0100007f4000723a8000000000000003 0100007f4000723a8000000000000000 0)
(0100007f4000723a8000000000000012 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:13.0003 0100007f4000723a8000000000000003 0100007f4000723a8000000000000003 0)
(0100007f4000723a8000000000000013 0100007f4000723a8000000000000001 null string "relationship-type" 0 true true 2006-02-07T20:24:13.0004 0100007f4000723a8000000000000004 0100007f4000723a8000000000000000 0)
(0100007f4000723a8000000000000014 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:14.0000 0100007f4000723a8000000000000004 0100007f4000723a8000000000000003 0)
(0100007f4000723a8000000000000015 0100007f4000723a8000000000000001 null string "attribute-type" 0 true true 2006-02-07T20:24:14.0001 0100007f4000723a8000000000000005 0100007f4000723a8000000000000000 0)
(0100007f4000723a8000000000000016 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:14.0002 0100007f4000723a8000000000000005 0100007f4000723a8000000000000003 0)
(0100007f4000723a8000000000000017 0100007f4000723a8000000000000001 null string "dimension" 0 true true 2006-02-07T20:24:14.0003 0100007f4000723a8000000000000006 0100007f4000723a8000000000000000 0)
(0100007f4000723a8000000000000018 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:14.0004 0100007f4000723a8000000000000006 0100007f4000723a8000000000000003 0)
(0100007f4000723a8000000000000019 0100007f4000723a8000000000000001 null string "root-namespace" 0 true true 2006-02-07T20:24:15.0000 0100007f4000723a8000000000000007 0100007f4000723a8000000000000000 0)
(0100007f4000723a800000000000001a 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:15.0001 0100007f4000723a8000000000000007 0100007f4000723a8000000000000009 0)
(0100007f4000723a800000000000001b 0100007f4000723a8000000000000001 null string "display-name" 0 true true 2006-02-07T20:24:15.0002 0100007f4000723a8000000000000008 0100007f4000723a8000000000000000 0)
(0100007f4000723a800000000000001c 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:15.0003 0100007f4000723a8000000000000008 0100007f4000723a8000000000000005 0)
(0100007f4000723a800000000000001d 0100007f4000723a8000000000000001 null string "namespace" 0 true true 2006-02-07T20:24:15.0004 0100007f4000723a8000000000000009 0100007f4000723a8000000000000000 0)
(0100007f4000723a800000000000001e 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:15.0005 0100007f4000723a8000000000000009 0100007f4000723a8000000000000003 0)
(0100007f4000723a800000000000001f null null null null 0 true true 2006-02-07T20:24:15.0006 0 0 0)
(0100007f4000723a8000000000000020 null null null null 0 true true 2006-02-07T20:24:15.0007 0 0 0)
(0100007f4000723a8000000000000021 null null null null 0 true true 2006-02-07T20:24:16.0000 0 0 0)
(0100007f4000723a8000000000000022 null null null null 0 true true 2006-02-07T20:24:16.0001 0 0 0)
(0100007f4000723a8000000000000023 null null null null 0 true true 2006-02-07T20:24:16.0002 0 0 0)
(0100007f4000723a8000000000000024 null null null null 0 true true 2006-02-07T20:24:16.0003 0 0 0)
(0100007f4000723a8000000000000025 0100007f4000723a8000000000000001 null string "generic-concept" 0 true true 2006-02-07T20:24:16.0004 0100007f4000723a800000000000001f 0100007f4000723a8000000000000000 0)
(0100007f4000723a8000000000000026 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:16.0005 0100007f4000723a800000000000001f 0100007f4000723a8000000000000003 0)
(0100007f4000723a8000000000000027 0100007f4000723a8000000000000001 null string "outgoing-schema-suggests" 0 true true 2006-02-07T20:24:17.0000 0100007f4000723a8000000000000020 0100007f4000723a8000000000000000 0)
(0100007f4000723a8000000000000028 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:17.0001 0100007f4000723a8000000000000020 0100007f4000723a8000000000000004 0)
(0100007f4000723a8000000000000029 0100007f4000723a8000000000000001 null string "incoming-schema-suggests" 0 true true 2006-02-07T20:24:17.0002 0100007f4000723a8000000000000021 0100007f4000723a8000000000000000 0)
(0100007f4000723a800000000000002a 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:17.0003 0100007f4000723a8000000000000021 0100007f4000723a8000000000000004 0)
(0100007f4000723a800000000000002b 0100007f4000723a8000000000000001 null string "language" 0 true true 2006-02-07T20:24:17.0004 0100007f4000723a8000000000000022 0100007f4000723a8000000000000000 0)
(0100007f4000723a800000000000002c 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:17.0005 0100007f4000723a8000000000000022 0100007f4000723a8000000000000003 0)
(0100007f4000723a800000000000002d 0100007f4000723a8000000000000001 null string "language-codes" 0 true true 2006-02-07T20:24:18.0000 0100007f4000723a8000000000000023 0100007f4000723a8000000000000000 0)
(0100007f4000723a800000000000002e 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:18.0001 0100007f4000723a8000000000000023 0100007f4000723a8000000000000009 0)
(0100007f4000723a800000000000002f 0100007f4000723a8000000000000001 null string "en" 0 true true 2006-02-07T20:24:18.0002 0100007f4000723a8000000000000024 0100007f4000723a8000000000000023 0)
(0100007f4000723a8000000000000030 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:18.0003 0100007f4000723a8000000000000024 0100007f4000723a8000000000000006 0)
(0100007f4000723a8000000000000031 0100007f4000723a8000000000000001 null string "English" 0 true true 2006-02-07T20:24:18.0004 0100007f4000723a8000000000000024 0100007f4000723a8000000000000024 0)
(0100007f4000723a8000000000000032 null null null null 0 true true 2006-02-07T20:24:18.0005 0 0 0)
(0100007f4000723a8000000000000033 0100007f4000723a8000000000000001 null string "incoming-schema-suggests" 0 true true 2006-02-07T20:24:19.0000 0100007f4000723a8000000000000032 0100007f4000723a8000000000000000 0)
(0100007f4000723a8000000000000034 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:19.0001 0100007f4000723a8000000000000032 0100007f4000723a8000000000000004 0)
(0100007f4000723a8000000000000035 null null null null 0 true true 2006-02-07T20:24:19.0002 0 0 0)
(0100007f4000723a8000000000000036 0100007f4000723a8000000000000001 null string "incoming-schema-suggests" 0 true true 2006-02-07T20:24:19.0003 0100007f4000723a8000000000000035 0100007f4000723a8000000000000000 0)
(0100007f4000723a8000000000000037 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:19.0004 0100007f4000723a8000000000000035 0100007f4000723a8000000000000004 0)
(0100007f4000723a8000000000000038 null null null null 0 true true 2006-02-07T20:24:19.0005 0 0 0)
(0100007f4000723a8000000000000039 0100007f4000723a8000000000000001 null string "incoming-schema-suggests" 0 true true 2006-02-07T20:24:19.0006 0100007f4000723a8000000000000038 0100007f4000723a8000000000000000 0)
(0100007f4000723a800000000000003a 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:20.0000 0100007f4000723a8000000000000038 0100007f4000723a8000000000000004 0)
(0100007f4000723a800000000000003b null null null null 0 true true 2006-02-07T20:24:20.0001 0 0 0)
(0100007f4000723a800000000000003c 0100007f4000723a8000000000000001 null string "incoming-schema-suggests" 0 true true 2006-02-07T20:24:20.0002 0100007f4000723a800000000000003b 0100007f4000723a8000000000000000 0)
(0100007f4000723a800000000000003d 0100007f4000723a8000000000000002 null null null 0 true true 2006-02-07T20:24:20.0003 0100007f4000723a800000000000003b 0100007f4000723a8000000000000004 0)
(0100007f4000723a800000000000003e 0100007f4000723a8000000000000020 null null null 0 true true 2006-02-07T20:24:20.0004 0100007f4000723a8000000000000003 0100007f4000723a8000000000000020 0)
(0100007f4000723a800000000000003f 0100007f4000723a8000000000000020 null null null 0 true true 2006-02-07T20:24:20.0005 0100007f4000723a8000000000000003 0100007f4000723a8000000000000021 0)
(0100007f4000723a8000000000000040 0100007f4000723a8000000000000020 null null null 0 true true 2006-02-07T20:24:20.0006 0100007f4000723a8000000000000004 0100007f4000723a8000000000000032 0)
(0100007f4000723a8000000000000041 0100007f4000723a8000000000000020 null null null 0 true true 2006-02-07T20:24:21.0000 0100007f4000723a8000000000000004 0100007f4000723a8000000000000035 0)
(0100007f4000723a8000000000000042 0100007f4000723a8000000000000020 null null null 0 true true 2006-02-07T20:24:21.0001 0100007f4000723a8000000000000004 0100007f4000723a8000000000000038 0)
(0100007f4000723a8000000000000043 0100007f4000723a8000000000000020 null null null 0 true true 2006-02-07T20:24:21.0002 0100007f4000723a8000000000000004 0100007f4000723a800000000000003b 0)
(0100007f4000723a8000000000000044 0100007f4000723a8000000000000035 null null null 0 true true 2006-02-07T20:24:21.0003 0100007f4000723a8000000000000020 0100007f4000723a8000000000000004 0)
(0100007f4000723a8000000000000045 0100007f4000723a8000000000000032 null null null 0 true true 2006-02-07T20:24:21.0004 0100007f4000723a8000000000000020 0100007f4000723a8000000000000003 0)
(0100007f4000723a8000000000000046 0100007f4000723a8000000000000035 null null null 0 true true 2006-02-07T20:24:21.0005 0100007f4000723a8000000000000021 0100007f4000723a8000000000000004 0)
(0100007f4000723a8000000000000047 0100007f4000723a8000000000000032 null null null 0 true true 2006-02-07T20:24:21.0006 0100007f4000723a8000000000000021 0100007f4000723a8000000000000003 0)
)
	write (node (-> typeguid=0100007f4000723a8000000000000001
			value="data-source"
		key=(typeguid value right)
			right=0100007f4000723a8000000000000000))
	EOF
rm -rf $D
