Compare commits

..

87 Commits

Author SHA1 Message Date
josha.von.gizycki 7d7218a93f add assertion
1 year ago
josha.von.gizycki 86b872e01e v0.3.1
1 year ago
josha.von.gizycki f0071176b3 re-add nrepl as dependency
1 year ago
Josha von Gizycki c7b3f4e69a fix deletion of instances with revisions
2 years ago
Josha von Gizycki 57412a5544 add test that proves deleting edited instances breaks
2 years ago
Josha von Gizycki 0d9e44b75d add basic responsive layout
3 years ago
Josha von Gizycki 5f3ed0e363 write files when uploading
3 years ago
Josha von Gizycki 2c33c6cdcc preparations for file upload - move formulare into wanijo
3 years ago
Josha von Gizycki 21ef517cec creation of revisions
3 years ago
Josha von Gizycki 4e5c86b808 updates from trio branch, tests
3 years ago
Josha von Gizycki 133eb49d6b alfred job file
4 years ago
Josha von Gizycki d5788b1e84 fix assign form usage
4 years ago
Josha von Gizycki 5cf380858a add .lsp to gitignore
4 years ago
Josha von Gizycki 6836ea33d8 clean up transitive dependencies
4 years ago
Josha von Gizycki cde6313108 add three more test cases to system test
4 years ago
Josha von Gizycki 5c7f578704 add tests for linking
4 years ago
Josha von Gizycki 3b8e6f196a add instance test
4 years ago
Josha von Gizycki bc0585f772 refactor system test to use controller functions
4 years ago
Josha von Gizycki 4e3f0f86bd first part of an automated system test
4 years ago
Josha von Gizycki 08fc2403a1 proper permissions in instance routes, qol on assigning forms in schemas
4 years ago
Josha von Gizycki d68cf05e47 list only schemas you have permissions for
4 years ago
Josha von Gizycki d81106b7c3 rename wanijo.infrastructure to wanijo.infra
4 years ago
Josha von Gizycki 5e28072b24 remove unused file
4 years ago
Josha von Gizycki 5c7f71b368 the next restyling, some restructuring
4 years ago
Josha von Gizycki 8d92817e15 implement on-demand numerical sort in dyntables
4 years ago
Josha von Gizycki a52c15649e Merge branch 'neo4j-4'
4 years ago
Josha von Gizycki df136ba247 update dependencies, fix neo4j-clj-problems, fix $-syntax
4 years ago
Josha von Gizycki 61d1b55240 fix weird degradation of neo4j-clj
4 years ago
Josha von Gizycki 72def1be2a change parameter syntax
4 years ago
Josha von Gizycki 1f42aad23e replace old param syntax
4 years ago
Josha von Gizycki 337422ae16 upgrade to neo4j v4 and inmemory connection
4 years ago
Josha von Gizycki 5165be07ac debugging stuff, make repl reasier, bulk linking
4 years ago
Josha von Gizycki bf890aaed5 add manual changing of neo4j connection
4 years ago
Josha von Gizycki e72bdf2dff add some readme info
4 years ago
Josha von Gizycki 3cf0c7117a add sub-form capabilities, nicer bulk linking tables
4 years ago
Josha von Gizycki 3f2623d8b6 some tinkering on bulk link creation
4 years ago
Josha von Gizycki 56fc3dfe01 update on readme, moar titles, correction in last migration
4 years ago
Josha von Gizycki ddd2c689f6 nrepl! documentation!
5 years ago
Josha von Gizycki 84a8c076a2 fix migration setting version too soon
5 years ago
Josha von Gizycki 73a8e5f2b9 change how links work
5 years ago
Josha von Gizycki 6f18bfe7f8 Merge branch 'master' of https://gitea.heevyis.ninja/josha/wanijo
5 years ago
Josha von Gizycki 913653780c ancient
5 years ago
Josha von Gizycki b69471fd98 fix migrations
5 years ago
Josha von Gizycki fd9688e0a5 Merge branch 'master' of https://gitea.heevyis.ninja/josha/wanijooo
5 years ago
Josha von Gizycki 2500dcddc8 things i dont remember
5 years ago
Josha von Gizycki 0cf9596f87 more elegant no-anti-forgery-field-rendering
5 years ago
Josha von Gizycki 39e677c2f9 fix error on bulk link form submit
5 years ago
Josha von Gizycki 465ef3a75d bulk link creation - saving does not work yet
5 years ago
Josha von Gizycki 723f7fd09b deleting schemas - again!
5 years ago
Josha von Gizycki e52de87cbb remove unused import
5 years ago
Josha von Gizycki 0588e51730 dependencies
5 years ago
Josha von Gizycki 81a33bb68f naming conventions regarding side effects
5 years ago
Josha von Gizycki b535880c1d re-add less
5 years ago
Josha von Gizycki 61d69d36e2 add license
5 years ago
Josha von Gizycki 94cd4cdcc2 something for people to read
5 years ago
Josha von Gizycki fcd6d1e034 remove ring plugin
5 years ago
Josha von Gizycki daebe83503 fix spec name
5 years ago
Josha von Gizycki 5da877db21 fix wrong import
5 years ago
Josha von Gizycki 42ec83d2e6 Merge branch 'master' of https://gitea.heevyis.ninja/josha/wanijooo
5 years ago
Josha von Gizycki c51a93be13 fix wron spec name
5 years ago
Josha von Gizycki 53bca6a698 show required attributes in instance list
5 years ago
Josha von Gizycki 6d256c6d37 rework views in instance domain
5 years ago
Josha von Gizycki 8a9c2a7a5b remove unused function
5 years ago
Josha von Gizycki b1d7c31a83 some logic into schema/domain
5 years ago
Josha von Gizycki cc30b94d24 cleanup
5 years ago
Josha von Gizycki e778186cfe rewind to old plugin, styling for markdown properties
5 years ago
Josha von Gizycki d31998230a rename param
5 years ago
Josha von Gizycki 0d0b90b84b ancient
5 years ago
Josha von Gizycki 7de0a88e60 long lines
5 years ago
Josha von Gizycki b29ef0d724 drastically simplify logic to detect duplicate attribute names
5 years ago
Josha von Gizycki 4aa3a14ba2 move logic from instance.db to instance.domain
5 years ago
Josha von Gizycki 61dbceb364 move specs from attribute.db to attribute.domain, rename aliases
5 years ago
Josha von Gizycki 8479133d58 rename wanijo.framework to wanijo.infrastructure
5 years ago
Josha von Gizycki 66e3401024 rename dev app
5 years ago
Josha von Gizycki 4e1ae1c5bc fix random utf bonkers
5 years ago
Josha von Gizycki b80f5f3c40 renaim domain namespaces to db
5 years ago
Josha von Gizycki f328e95f4e light refactorings
5 years ago
Josha von Gizycki 00ef765485 link domain
5 years ago
Josha von Gizycki bd1fa8a7d7 remove unused logo files
5 years ago
Josha von Gizycki 255f9d7ee9 add missing wrapper to standalone-app
5 years ago
Josha von Gizycki 3e8c38ec44 fix sorting
5 years ago
Josha von Gizycki c03a526308 remove debug output, fix js sorting
5 years ago
Josha von Gizycki 8937d28346 specs, again!
5 years ago
Josha von Gizycki d3efb3165e add basic exploration feature
5 years ago
Josha von Gizycki 4590a345b1 remove elm
5 years ago
Josha von Gizycki 5d7f62d142 make hopefully all instance lists searchable by tags
5 years ago
Josha von Gizycki 62929a8c22 search in tables by tag
5 years ago

@ -0,0 +1,8 @@
#!/bin/bash
if lein test; then
echo "testing successul";
else
echo "tests failed";
sendmail -s "wanijo build failed" mail@joshavg.de < $ALFRED_LOG_FILE;
fi;

2
.gitignore vendored

@ -16,4 +16,6 @@ neo4j/*
resources/public/js/out
.rebel_readline_history
/elm-stuff
.lsp
*.*~
*#*

@ -0,0 +1,675 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

@ -0,0 +1,57 @@
# Wanijo
> (Toki Pona)
> Wan: One, a, unite, make one
> Ijo: thing, something, object
> Wanijo: Unite things
## How to develop
You'll need:
- JDK >= 8
- Leiningen >= 2.9
### First time launch with fresh a database
- start a neo4j database with `lein neo4j`
- start a repl with `lein repl` or similar
- import `wanijo.infra.repl`
- if you use leiningen for launching the repl, this will be your init-ns
- run `wanijo.infra.repl/create-user!` using the desired username and password as parameters to create an application user
- run `wanijo.infra.repl/run-migrations!` to create desireable database constraints and structures
### Launch the application server
- start a repl
- import `wanijo.infra.repl`
- run `wanijo.infra.repl/dev-server!`
- the application is available on port `8080`
## Launch as a standalone
- build the uberjar via `lein uberjar`
- start your neo4j database, preferably **not** via `lein neo4j`
- use the environment variables `NEO4J_PORT`, `NEO4J_HOST`, `NEO4J_USER` and `NEO4J_PASS` to control how wanijo connects to the database
- start the jar file via `java -jar [jar-file]-standalone.jar`
- if this is the first start with a fresh database, connect to the nREPL as described in the chapter "nREPL" and run the commands described in "First time launch with a fresh database"
### nREPL
When started via its `main` method, as is the uberjar case, an nREPL server is started with it. The default port is `7888`, but this can be configured via the `NREPL_PORT` environment variable.
To connect via the command line, use the following command:
```
clj -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.7.0"}}}' -m nrepl.cmdline --connect --host host --port port
```
### "Architecture"
> Structure your application as it seems to fit your needs. Then call it architecture and pat yourself on the shoulder. You've achieved something!
The first level of structure are the building blocks of the domain, e.g. `instance`, `schema`. Inside these namespaces you'll find namespaces for each technical need: routing, database access, domain rules etc.
`wanijo.handler` collects all routes and passes them to ring.
`wanijo.infra` contains the namespaces needed for technical code that do not belong to any domain, like database access, routing or similars.

@ -1,24 +0,0 @@
{
"type": "application",
"source-directories": [
"src/frontend"
],
"elm-version": "0.19.0",
"dependencies": {
"direct": {
"elm/browser": "1.0.1",
"elm/core": "1.0.2",
"elm/html": "1.0.0"
},
"indirect": {
"elm/json": "1.1.3",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}

@ -1,66 +1,78 @@
(defproject wanijo "0.3.0"
(defproject wanijo "0.3.1"
:description "Graph Database via UI"
:url "https://gitea.heevyis.ninja/josha/wanijo"
:min-lein-version "2.0.0"
:min-lein-version "2.9.0"
:license {:name "GPL-3.0"
:url "https://opensource.org/licenses/GPL-3.0"}
:dependencies [;;clojure core
[org.clojure/clojure "1.10.1"]
[nrepl "1.0.0"]
;; static site
[compojure "1.6.1"]
[compojure "1.6.2"]
[ring/ring-defaults "0.3.2"]
[ring/ring-jetty-adapter "1.7.1"
[ring/ring-jetty-adapter "1.8.2"
:exclusions [ring/ring-core
ring/ring-codec
commons-io
commons-codec]]
[ring/ring-json "0.4.0"]
[ring/ring-json "0.5.0"]
[hiccup "1.0.5"]
[joshavg/formulare "0.4.0"]
;[joshavg/formulare "0.6.0"]
;; compojure uses old transitive dependencies of ring
;; specifiy them here explicitly so newer versions
;; will be used
[ring/ring-core "1.8.2"]
[ring/ring-codec "1.1.2"]
;; neo4j
[gorillalabs/neo4j-clj "2.0.1"
:exclusions [org.bouncycastle/bcprov-jdk15on
org.bouncycastle/bcpkix-jdk15on
com.github.ben-manes.caffeine/caffeine]]
[gorillalabs/neo4j-clj "4.1.0"]
[org.neo4j.test/neo4j-harness "4.2.1"
:exclusions
[org.eclipse.jetty/jetty-server
org.eclipse.jetty/jetty-http
org.eclipse.jetty/jetty-io
org.eclipse.jetty/jetty-util
com.fasterxml.jackson.core/jackson-core
jakarta.activation/jakarta.activation-api
commons-codec
commons-io]]
;; additional server side libs
[buddy/buddy-hashers "1.4.0"
:exclusions [commons-codec]]
[clj-time "0.15.1"]
[markdown-clj "1.10.0"]
[buddy/buddy-hashers "1.7.0"
:exclusions
[com.fasterxml.jackson.dataformat/jackson-dataformat-smile
com.fasterxml.jackson.dataformat/jackson-dataformat-cbor
com.fasterxml.jackson.core/jackson-core
org.bouncycastle/bcprov-jdk15on
org.bouncycastle/bcpkix-jdk15on
commons-codec
cheshire
tigris]]
[clj-time "0.15.2"]
[markdown-clj "1.10.5"]
[dorothy "0.0.7"]]
:profiles {:dev {:dependencies [;; webserver stuff
[javax.servlet/servlet-api "2.5"]
[ring/ring-mock "0.4.0"]
[ring/ring-devel "1.7.1"
:exclusions [ring/ring-core
ring/ring-codec
commons-io
commons-codec]]
[joshavg/lein-neo4j "0.6.0-SNAPSHOT"]]
:plugins [;; neo4j db
[joshavg/lein-neo4j "0.6.0-SNAPSHOT"]
;; webserver stuff
:profiles {:dev {:plugins [;; web stuff
[lein-less "1.7.5"]
[lein-ring "0.12.5"]
[joshavg/lein-neo4j "0.5.0"]
;; code quality
[lein-ancient "LATEST"]
[jonase/eastwood "LATEST"]
[lein-bikeshed "LATEST"]
[lein-cloverage "LATEST"]
[cider/cider-nrepl "0.21.1"]
[lein-kibit "LATEST"]]}
[lein-kibit "LATEST"]
; [cider/cider-nrepl "0.26.0"]
]}
:uberjar {:aot :all
:main wanijo.main}}
:neo4j {:path "neo4j"}
:repl-options {:init-ns wanijo.framework.repl}
:ring {:handler wanijo.handler/app
:nrepl {:start? true}}
:repl-options {:init-ns wanijo.infra.repl}
:less {:source-paths ["resources/app/stylesheets"]
:target-path "resources/public/css"}
:aliases {"uberjar" ["do" ["less" "once"] "uberjar"]}

@ -1,262 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:ooo="http://xml.openoffice.org/svg/export"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
width="136.87mm"
height="31.369999mm"
viewBox="0 0 13687 3136.9999"
preserveAspectRatio="xMidYMid"
xml:space="preserve"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="logo_full.svg"
style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round"><metadata
id="metadata126"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1888"
inkscape:window-height="1053"
id="namedview124"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="0.22425739"
inkscape:cx="229.24117"
inkscape:cy="-107.39766"
inkscape:window-x="32"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><defs
class="ClipPathGroup"
id="defs4"><clipPath
id="presentation_clip_path"
clipPathUnits="userSpaceOnUse"><rect
x="0"
y="0"
width="21000"
height="29700"
id="rect7" /></clipPath></defs><defs
class="TextShapeIndex"
id="defs9"><g
ooo:slide="id1"
ooo:id-list="id3 id4 id5 id6"
id="g11" /></defs><defs
class="EmbeddedBulletChars"
id="defs13"><g
id="bullet-char-template(57356)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 580,1141 1163,571 580,0 -4,571 580,1141 Z"
id="path16"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(57354)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 8,1128 1129,0 L 1137,0 8,0 8,1128 Z"
id="path19"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10146)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 174,0 602,739 174,1481 1456,739 174,0 Z m 1184,739 -1049,607 350,-607 699,0 z"
id="path22"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10132)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 2015,739 1276,0 717,0 l 543,543 -1086,0 0,393 1086,0 -543,545 557,0 741,-742 z"
id="path25"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10007)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 0,-2 c -7,16 -16,29 -25,39 l 381,530 c -94,256 -141,385 -141,387 0,25 13,38 40,38 9,0 21,-2 34,-5 21,4 42,12 65,25 l 27,-13 111,-251 280,301 64,-25 24,25 c 21,-10 41,-24 62,-43 C 886,937 835,863 770,784 769,783 710,716 594,584 L 774,223 c 0,-27 -21,-55 -63,-84 l 16,-20 C 717,90 699,76 672,76 641,76 570,178 457,381 L 164,-76 c -22,-34 -53,-51 -92,-51 -42,0 -63,17 -64,51 -7,9 -10,24 -10,44 0,9 1,19 2,30 z"
id="path28"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10004)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 285,-33 C 182,-33 111,30 74,156 52,228 41,333 41,471 c 0,78 14,145 41,201 34,71 87,106 158,106 53,0 88,-31 106,-94 l 23,-176 c 8,-64 28,-97 59,-98 l 735,706 c 11,11 33,17 66,17 42,0 63,-15 63,-46 l 0,-122 c 0,-36 -10,-64 -30,-84 L 442,47 C 390,-6 338,-33 285,-33 Z"
id="path31"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(9679)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 813,0 C 632,0 489,54 383,161 276,268 223,411 223,592 c 0,181 53,324 160,431 106,107 249,161 430,161 179,0 323,-54 432,-161 108,-107 162,-251 162,-431 0,-180 -54,-324 -162,-431 C 1136,54 992,0 813,0 Z"
id="path34"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(8226)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 346,457 c -73,0 -137,26 -191,78 -54,51 -81,114 -81,188 0,73 27,136 81,188 54,52 118,78 191,78 73,0 134,-26 185,-79 51,-51 77,-114 77,-187 0,-75 -25,-137 -76,-188 -50,-52 -112,-78 -186,-78 z"
id="path37"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(8211)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m -4,459 1139,0 0,147 -1139,0 0,-147 z"
id="path40"
inkscape:connector-curvature="0" /></g></defs><defs
class="TextEmbeddedBitmaps"
id="defs42" /><g
id="g44"
transform="translate(-4282,-8682)"><g
id="id2"
class="Master_Slide"><g
id="bg-id2"
class="Background" /><g
id="bo-id2"
class="BackgroundObjects" /></g></g><g
class="SlideGroup"
id="g49"
transform="translate(-4282,-8682)"><g
id="g51"><g
id="id1"
class="Slide"
clip-path="url(#presentation_clip_path)"><g
class="Page"
id="g54"><g
class="com.sun.star.drawing.CustomShape"
id="g56"><g
id="id3"><rect
class="BoundingBox"
x="4282"
y="8682"
width="2437"
height="1337"
id="rect59"
style="fill:none;stroke:none" /><path
d="m 5500,10000 -1200,0 0,-1300 2400,0 0,1300 -1200,0 z"
id="path61"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /></g></g><g
class="com.sun.star.drawing.CustomShape"
id="g63"><g
id="id4"><rect
class="BoundingBox"
x="7382"
y="10482"
width="2437"
height="1337"
id="rect66"
style="fill:none;stroke:none" /><path
d="m 8600,11800 -1200,0 0,-807"
id="path68"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7400,10841 0,-35"
id="path70"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7400,10654 0,-35"
id="path72"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7433,10500 35,0"
id="path74"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7620,10500 35,0"
id="path76"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7807,10500 35,0"
id="path78"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7994,10500 35,0"
id="path80"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8181,10500 35,0"
id="path82"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8368,10500 35,0"
id="path84"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8555,10500 35,0"
id="path86"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8742,10500 35,0"
id="path88"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8929,10500 871,0 0,1136"
id="path90"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 9800,11788 0,12 -23,0"
id="path92"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 9625,11800 -35,0"
id="path94"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 9438,11800 -35,0"
id="path96"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 9251,11800 -35,0"
id="path98"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 9064,11800 -35,0"
id="path100"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8877,11800 -35,0"
id="path102"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8690,11800 -35,0"
id="path104"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /></g></g><g
class="com.sun.star.drawing.ConnectorShape"
id="g106"><g
id="id5"><rect
class="BoundingBox"
x="5482"
y="9982"
width="1919"
height="1295"
id="rect109"
style="fill:none;stroke:none" /><path
d="m 5500,10000 0,1150 1539,0"
id="path111"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7400,11150 -378,-126 0,252 378,-126 z"
id="path113"
inkscape:connector-curvature="0"
style="fill:#000000;stroke:none" /></g></g><g
class="com.sun.star.drawing.ConnectorShape"
id="g115"><g
id="id6"><rect
class="BoundingBox"
x="9782"
y="11024"
width="8187"
height="253"
id="rect118"
style="fill:none;stroke:none" /><path
d="m 9800,11150 7807,0"
id="path120"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 17968,11150 -378,-126 0,252 378,-126 z"
id="path122"
inkscape:connector-curvature="0"
style="fill:#000000;stroke:none" /></g></g></g></g></g></g></svg>

Before

Width:  |  Height:  |  Size: 12 KiB

@ -1,262 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:ooo="http://xml.openoffice.org/svg/export"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
width="80mm"
height="31.369999mm"
viewBox="0 0 8000.0003 3136.9999"
preserveAspectRatio="xMidYMid"
xml:space="preserve"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="logo_left.svg"
style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round"><metadata
id="metadata126"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1888"
inkscape:window-height="1053"
id="namedview124"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="2.5371827"
inkscape:cx="236.38083"
inkscape:cy="69.110121"
inkscape:window-x="32"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><defs
class="ClipPathGroup"
id="defs4"><clipPath
id="presentation_clip_path"
clipPathUnits="userSpaceOnUse"><rect
x="0"
y="0"
width="21000"
height="29700"
id="rect7" /></clipPath></defs><defs
class="TextShapeIndex"
id="defs9"><g
ooo:slide="id1"
ooo:id-list="id3 id4 id5 id6"
id="g11" /></defs><defs
class="EmbeddedBulletChars"
id="defs13"><g
id="bullet-char-template(57356)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 580,1141 1163,571 580,0 -4,571 580,1141 Z"
id="path16"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(57354)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 8,1128 1129,0 L 1137,0 8,0 8,1128 Z"
id="path19"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10146)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 174,0 602,739 174,1481 1456,739 174,0 Z m 1184,739 -1049,607 350,-607 699,0 z"
id="path22"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10132)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 2015,739 1276,0 717,0 l 543,543 -1086,0 0,393 1086,0 -543,545 557,0 741,-742 z"
id="path25"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10007)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 0,-2 c -7,16 -16,29 -25,39 l 381,530 c -94,256 -141,385 -141,387 0,25 13,38 40,38 9,0 21,-2 34,-5 21,4 42,12 65,25 l 27,-13 111,-251 280,301 64,-25 24,25 c 21,-10 41,-24 62,-43 C 886,937 835,863 770,784 769,783 710,716 594,584 L 774,223 c 0,-27 -21,-55 -63,-84 l 16,-20 C 717,90 699,76 672,76 641,76 570,178 457,381 L 164,-76 c -22,-34 -53,-51 -92,-51 -42,0 -63,17 -64,51 -7,9 -10,24 -10,44 0,9 1,19 2,30 z"
id="path28"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10004)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 285,-33 C 182,-33 111,30 74,156 52,228 41,333 41,471 c 0,78 14,145 41,201 34,71 87,106 158,106 53,0 88,-31 106,-94 l 23,-176 c 8,-64 28,-97 59,-98 l 735,706 c 11,11 33,17 66,17 42,0 63,-15 63,-46 l 0,-122 c 0,-36 -10,-64 -30,-84 L 442,47 C 390,-6 338,-33 285,-33 Z"
id="path31"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(9679)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 813,0 C 632,0 489,54 383,161 276,268 223,411 223,592 c 0,181 53,324 160,431 106,107 249,161 430,161 179,0 323,-54 432,-161 108,-107 162,-251 162,-431 0,-180 -54,-324 -162,-431 C 1136,54 992,0 813,0 Z"
id="path34"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(8226)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 346,457 c -73,0 -137,26 -191,78 -54,51 -81,114 -81,188 0,73 27,136 81,188 54,52 118,78 191,78 73,0 134,-26 185,-79 51,-51 77,-114 77,-187 0,-75 -25,-137 -76,-188 -50,-52 -112,-78 -186,-78 z"
id="path37"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(8211)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m -4,459 1139,0 0,147 -1139,0 0,-147 z"
id="path40"
inkscape:connector-curvature="0" /></g></defs><defs
class="TextEmbeddedBitmaps"
id="defs42" /><g
id="g44"
transform="translate(-4282,-8682)"><g
id="id2"
class="Master_Slide"><g
id="bg-id2"
class="Background" /><g
id="bo-id2"
class="BackgroundObjects" /></g></g><g
class="SlideGroup"
id="g49"
transform="translate(-4282,-8682)"><g
id="g51"><g
id="id1"
class="Slide"
clip-path="url(#presentation_clip_path)"><g
class="Page"
id="g54"><g
class="com.sun.star.drawing.CustomShape"
id="g56"><g
id="id3"><rect
class="BoundingBox"
x="4282"
y="8682"
width="2437"
height="1337"
id="rect59"
style="fill:none;stroke:none" /><path
d="m 5500,10000 -1200,0 0,-1300 2400,0 0,1300 -1200,0 z"
id="path61"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /></g></g><g
class="com.sun.star.drawing.CustomShape"
id="g63"><g
id="id4"><rect
class="BoundingBox"
x="7382"
y="10482"
width="2437"
height="1337"
id="rect66"
style="fill:none;stroke:none" /><path
d="m 8600,11800 -1200,0 0,-807"
id="path68"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7400,10841 0,-35"
id="path70"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7400,10654 0,-35"
id="path72"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7433,10500 35,0"
id="path74"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7620,10500 35,0"
id="path76"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7807,10500 35,0"
id="path78"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7994,10500 35,0"
id="path80"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8181,10500 35,0"
id="path82"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8368,10500 35,0"
id="path84"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8555,10500 35,0"
id="path86"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8742,10500 35,0"
id="path88"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8929,10500 871,0 0,1136"
id="path90"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 9800,11788 0,12 -23,0"
id="path92"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 9625,11800 -35,0"
id="path94"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 9438,11800 -35,0"
id="path96"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 9251,11800 -35,0"
id="path98"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 9064,11800 -35,0"
id="path100"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8877,11800 -35,0"
id="path102"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 8690,11800 -35,0"
id="path104"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /></g></g><g
class="com.sun.star.drawing.ConnectorShape"
id="g106"><g
id="id5"><rect
class="BoundingBox"
x="5482"
y="9982"
width="1919"
height="1295"
id="rect109"
style="fill:none;stroke:none" /><path
d="m 5500,10000 0,1150 1539,0"
id="path111"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 7400,11150 -378,-126 0,252 378,-126 z"
id="path113"
inkscape:connector-curvature="0"
style="fill:#000000;stroke:none" /></g></g><g
class="com.sun.star.drawing.ConnectorShape"
id="g115"><g
id="id6"><rect
class="BoundingBox"
x="9782"
y="11024"
width="8187"
height="253"
id="rect118"
style="fill:none;stroke:none" /><path
d="m 9800,11150 7807,0"
id="path120"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 17968,11150 -378,-126 0,252 378,-126 z"
id="path122"
inkscape:connector-curvature="0"
style="fill:#000000;stroke:none" /></g></g></g></g></g></g></svg>

Before

Width:  |  Height:  |  Size: 12 KiB

@ -1,145 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:ooo="http://xml.openoffice.org/svg/export"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
width="80mm"
height="31.369999mm"
viewBox="0 0 8000.0003 3136.9999"
preserveAspectRatio="xMidYMid"
xml:space="preserve"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="logo_mid.svg"
style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round"><metadata
id="metadata126"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1888"
inkscape:window-height="1053"
id="namedview124"
showgrid="false"
fit-margin-top="0"
fit-margin-left="2.7755576e-17"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="7.1762365"
inkscape:cx="272.04377"
inkscape:cy="10.865732"
inkscape:window-x="32"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g49" /><defs
class="ClipPathGroup"
id="defs4"><clipPath
id="presentation_clip_path"
clipPathUnits="userSpaceOnUse"><rect
x="0"
y="0"
width="21000"
height="29700"
id="rect7" /></clipPath></defs><defs
class="TextShapeIndex"
id="defs9"><g
ooo:slide="id1"
ooo:id-list="id3 id4 id5 id6"
id="g11" /></defs><defs
class="EmbeddedBulletChars"
id="defs13"><g
id="bullet-char-template(57356)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 580,1141 1163,571 580,0 -4,571 580,1141 Z"
id="path16"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(57354)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 8,1128 1129,0 L 1137,0 8,0 8,1128 Z"
id="path19"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10146)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 174,0 602,739 174,1481 1456,739 174,0 Z m 1184,739 -1049,607 350,-607 699,0 z"
id="path22"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10132)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 2015,739 1276,0 717,0 l 543,543 -1086,0 0,393 1086,0 -543,545 557,0 741,-742 z"
id="path25"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10007)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 0,-2 c -7,16 -16,29 -25,39 l 381,530 c -94,256 -141,385 -141,387 0,25 13,38 40,38 9,0 21,-2 34,-5 21,4 42,12 65,25 l 27,-13 111,-251 280,301 64,-25 24,25 c 21,-10 41,-24 62,-43 C 886,937 835,863 770,784 769,783 710,716 594,584 L 774,223 c 0,-27 -21,-55 -63,-84 l 16,-20 C 717,90 699,76 672,76 641,76 570,178 457,381 L 164,-76 c -22,-34 -53,-51 -92,-51 -42,0 -63,17 -64,51 -7,9 -10,24 -10,44 0,9 1,19 2,30 z"
id="path28"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10004)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 285,-33 C 182,-33 111,30 74,156 52,228 41,333 41,471 c 0,78 14,145 41,201 34,71 87,106 158,106 53,0 88,-31 106,-94 l 23,-176 c 8,-64 28,-97 59,-98 l 735,706 c 11,11 33,17 66,17 42,0 63,-15 63,-46 l 0,-122 c 0,-36 -10,-64 -30,-84 L 442,47 C 390,-6 338,-33 285,-33 Z"
id="path31"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(9679)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 813,0 C 632,0 489,54 383,161 276,268 223,411 223,592 c 0,181 53,324 160,431 106,107 249,161 430,161 179,0 323,-54 432,-161 108,-107 162,-251 162,-431 0,-180 -54,-324 -162,-431 C 1136,54 992,0 813,0 Z"
id="path34"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(8226)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 346,457 c -73,0 -137,26 -191,78 -54,51 -81,114 -81,188 0,73 27,136 81,188 54,52 118,78 191,78 73,0 134,-26 185,-79 51,-51 77,-114 77,-187 0,-75 -25,-137 -76,-188 -50,-52 -112,-78 -186,-78 z"
id="path37"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(8211)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m -4,459 1139,0 0,147 -1139,0 0,-147 z"
id="path40"
inkscape:connector-curvature="0" /></g></defs><defs
class="TextEmbeddedBitmaps"
id="defs42" /><g
id="g44"
transform="translate(-4282,-8682)"><g
id="id2"
class="Master_Slide"><g
id="bg-id2"
class="Background" /><g
id="bo-id2"
class="BackgroundObjects" /></g></g><g
class="SlideGroup"
id="g49"
transform="translate(-4282,-8682)"><g
id="g115"
class="com.sun.star.drawing.ConnectorShape"
transform="matrix(1.0297825,0,0,1,-5813.9104,0)"><g
id="id6"><rect
style="fill:none;stroke:none"
id="rect118"
height="253"
width="8187"
y="11024"
x="9782"
class="BoundingBox" /><path
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round"
inkscape:connector-curvature="0"
id="path120"
d="m 9800,11150 7807,0" /><path
style="fill:#000000;stroke:none"
inkscape:connector-curvature="0"
id="path122"
d="m 17968,11150 -378,-126 0,252 378,-126 z" /></g></g><rect
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:28.22222328px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect3511"
width="975.31787"
height="676.43011"
x="16990.113"
y="10816.745" /></g></svg>

Before

Width:  |  Height:  |  Size: 6.4 KiB

@ -1,136 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:ooo="http://xml.openoffice.org/svg/export"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
width="80mm"
height="31.369999mm"
viewBox="0 0 8000.0003 3136.9999"
preserveAspectRatio="xMidYMid"
xml:space="preserve"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="logo_right.svg"
style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round"><metadata
id="metadata126"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1888"
inkscape:window-height="1053"
id="namedview124"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="5.0743655"
inkscape:cx="264.95786"
inkscape:cy="19.427883"
inkscape:window-x="32"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><defs
class="ClipPathGroup"
id="defs4"><clipPath
id="presentation_clip_path"
clipPathUnits="userSpaceOnUse"><rect
x="0"
y="0"
width="21000"
height="29700"
id="rect7" /></clipPath></defs><defs
class="TextShapeIndex"
id="defs9"><g
ooo:slide="id1"
ooo:id-list="id3 id4 id5 id6"
id="g11" /></defs><defs
class="EmbeddedBulletChars"
id="defs13"><g
id="bullet-char-template(57356)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 580,1141 1163,571 580,0 -4,571 580,1141 Z"
id="path16"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(57354)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 8,1128 1129,0 L 1137,0 8,0 8,1128 Z"
id="path19"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10146)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 174,0 602,739 174,1481 1456,739 174,0 Z m 1184,739 -1049,607 350,-607 699,0 z"
id="path22"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10132)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 2015,739 1276,0 717,0 l 543,543 -1086,0 0,393 1086,0 -543,545 557,0 741,-742 z"
id="path25"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10007)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 0,-2 c -7,16 -16,29 -25,39 l 381,530 c -94,256 -141,385 -141,387 0,25 13,38 40,38 9,0 21,-2 34,-5 21,4 42,12 65,25 l 27,-13 111,-251 280,301 64,-25 24,25 c 21,-10 41,-24 62,-43 C 886,937 835,863 770,784 769,783 710,716 594,584 L 774,223 c 0,-27 -21,-55 -63,-84 l 16,-20 C 717,90 699,76 672,76 641,76 570,178 457,381 L 164,-76 c -22,-34 -53,-51 -92,-51 -42,0 -63,17 -64,51 -7,9 -10,24 -10,44 0,9 1,19 2,30 z"
id="path28"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(10004)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 285,-33 C 182,-33 111,30 74,156 52,228 41,333 41,471 c 0,78 14,145 41,201 34,71 87,106 158,106 53,0 88,-31 106,-94 l 23,-176 c 8,-64 28,-97 59,-98 l 735,706 c 11,11 33,17 66,17 42,0 63,-15 63,-46 l 0,-122 c 0,-36 -10,-64 -30,-84 L 442,47 C 390,-6 338,-33 285,-33 Z"
id="path31"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(9679)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="M 813,0 C 632,0 489,54 383,161 276,268 223,411 223,592 c 0,181 53,324 160,431 106,107 249,161 430,161 179,0 323,-54 432,-161 108,-107 162,-251 162,-431 0,-180 -54,-324 -162,-431 C 1136,54 992,0 813,0 Z"
id="path34"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(8226)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m 346,457 c -73,0 -137,26 -191,78 -54,51 -81,114 -81,188 0,73 27,136 81,188 54,52 118,78 191,78 73,0 134,-26 185,-79 51,-51 77,-114 77,-187 0,-75 -25,-137 -76,-188 -50,-52 -112,-78 -186,-78 z"
id="path37"
inkscape:connector-curvature="0" /></g><g
id="bullet-char-template(8211)"
transform="scale(4.8828125e-4,-4.8828125e-4)"><path
d="m -4,459 1139,0 0,147 -1139,0 0,-147 z"
id="path40"
inkscape:connector-curvature="0" /></g></defs><defs
class="TextEmbeddedBitmaps"
id="defs42" /><g
id="g44"
transform="translate(-4282,-8682)"><g
id="id2"
class="Master_Slide"><g
id="bg-id2"
class="Background" /><g
id="bo-id2"
class="BackgroundObjects" /></g></g><g
class="com.sun.star.drawing.ConnectorShape"
id="g115"
transform="translate(-9973.911,-8682)"><g
id="id6"><rect
class="BoundingBox"
x="9782"
y="11024"
width="8187"
height="253"
id="rect118"
style="fill:none;stroke:none" /><path
d="m 9800,11150 7807,0"
id="path120"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:35;stroke-linejoin:round" /><path
d="m 17968,11150 -378,-126 0,252 378,-126 z"
id="path122"
inkscape:connector-curvature="0"
style="fill:#000000;stroke:none" /></g></g></svg>

Before

Width:  |  Height:  |  Size: 6.0 KiB

@ -1,5 +1,6 @@
@ci-blue: Highlight;
@ci-highlight: Highlight;
@error-color: #e00;
@warn-color: #eebc00;
@accent-color: #efefef;
@body-background-color: #fcfcfc;
@background-color: #eee;
@ -29,20 +30,6 @@ a:active {
text-decoration: underline;
}
h1 {
font-size: 1.5rem;
small {
font-weight: normal;
font-size: 1.5rem;
}
}
h2 {
font-size: 1.3rem;
border-bottom: 1px solid @ci-blue;
}
em {
font-weight: bold;
}
@ -57,7 +44,7 @@ img, svg {
}
.__icon {
color: @ci-blue;
color: @ci-highlight;
font-weight: bold;
}
@ -67,6 +54,49 @@ img, svg {
grid-template-areas: "header header" "nav main" "footer footer";
margin: auto;
h1 {
font-size: 1.5rem;
small {
font-weight: normal;
font-size: 1.5rem;
}
}
h2 {
font-size: 1.3rem;
border-bottom: 1px solid @ci-highlight;
}
.attr-type-markdown {
border: 1px solid @ci-color;
border-radius: .5rem;
padding: 1rem;
h1 {
font-size: 1.4rem;
margin-top: 0;
}
h2 {
font-size: 1.2rem;
border: none;
}
h3 {
font-size: 1.1rem;
}
blockquote, pre {
padding: .5rem;
background-color: Window;
border-radius: .4rem;
border: 1px solid transparent;
margin-left: 1rem;
margin-right: 1rem;
}
}
header, footer, main, nav, aside {
padding: @text-padding-v @text-padding-h;
}
@ -76,19 +106,18 @@ img, svg {
display: grid;
grid-template-columns: 40% 60%;
align-items: center;
margin-top: 0;
background-color: ThreeDShadow;
margin: 0 @element-margin;
//noinspection CssUnknownTarget
background-image: url("/img/logo-full-flipped.svg");
background-size: contain;
background-position: right;
background-origin: content-box;
background-repeat: no-repeat;
border-bottom: 1px solid @ci-blue;
border-bottom: 1px solid @ci-color;
.app-title {
grid-column: 1;
font-size: 1.5rem;
}
.app-title__hello {
font-size: 1rem;
@ -96,25 +125,29 @@ img, svg {
font-weight: normal;
font-style: italic;
}
}
.header-content {
grid-column: 2;
}
.header-content__link {
display: inline-block;
margin-right: @accent-border-width;
}
}
}
nav {
grid-area: nav;
background-color: Window;
padding-right: 0;
padding-right: @element-margin;
border-right: 1px solid @ci-color;
margin-top: @element-margin;
margin-left: @element-margin;
h2::before {
content: "▤ ";
color: @ci-blue;
color: @ci-highlight;
}
h2 {
@ -168,10 +201,18 @@ img, svg {
}
}
form {
form, .sub-form {
display: grid;
grid-template-columns: 30% 70%;
grid-auto-flow: row;
fieldset {
display: grid;
grid-column: 1 e("/") 3;
grid-template-columns: 30% 70%;
grid-auto-flow: row;
margin-bottom: @text-padding-h;
}
label, input, select, textarea, .flash {
margin-bottom: .7rem;
@ -194,21 +235,12 @@ form {
}
}
.flash--error {
.flash;
border-color: @error-color;
.flash__heading--error {
margin: 0;
background-color: @error-color;
color: white;
margin-top: -.7rem;
margin-left: -.7rem;
margin-right: -.7rem;
}
.delete-btn.__on-countdown {
font-weight: bold;
}
}
.flash {
.flash {
grid-column: 1 e("/") 3;
.thin-border;
border-left-width: @accent-border-width;
@ -221,10 +253,27 @@ form {
.flash__pred {
font-family: monospace;
}
}
.flash--error {
.flash;
border-color: @error-color;
.flash__heading--error {
background-color: @error-color;
color: white;
margin: -.7rem -.7rem 0;
}
}
.delete-btn.__on-countdown {
font-weight: bold;
.flash--warn {
.flash;
border-color: @warn-color;
.flash__heading--error {
background-color: @warn-color;
color: white;
margin: -.7rem -.7rem 0;
}
}
@ -236,6 +285,10 @@ form.inline {
}
}
form.no-grid {
display: block;
}
table {
width: 100%;
border-collapse: collapse;
@ -243,22 +296,27 @@ table {
margin-top: 1rem;
margin-bottom: 1rem;
.tags-for-search {
display: none;
}
thead {
position: sticky;
top: 0;
background-color: @body-background-color;
th {
padding: @text-padding-v @text-padding-h @text-padding-v + .3rem @text-padding-v;
padding: @text-padding-v @text-padding-h
@text-padding-v + .3rem @text-padding-v;
}
th[data-sort=desc]::after {
content: "🠻";
content: "";
display: inline;
}
th[data-sort=asc]::after {
content: "🠹";
content: "";
display: inline;
}
}
@ -305,6 +363,7 @@ table {
button, input {
margin-right: @element-margin;
margin-bottom: 0;
}
}
@ -312,16 +371,39 @@ table {
margin: 0;
padding: 0;
list-style-type: none;
}
.tag-list li {
li {
margin-right: .5rem;
display: inline-block;
}
}
.single-tag {
border: 1px solid @ci-color;
border-left: .5rem solid @ci-blue;
border-left: .5rem solid @ci-highlight;
border-radius: .5rem;
padding: .1rem .4rem;
}
.vis-canvas {
border: 1px solid @ci-highlight;
height: 45rem;
}
@media (max-width: 768px) {
.grid {
grid-template-columns: auto;
grid-template-areas: "header" "nav" "main" "footer";
header {
grid-template-columns: auto;
.header-content {
grid-column: 1;
text-align: center;
}
}
}
}

@ -1,24 +0,0 @@
.devbar {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
font-family: monospace;
background-color: #ccc;
ol {
list-style-type: none;
padding: 0;
margin: 0;
li {
padding: .5rem;
border: 1px solid black;
margin: .5rem;
pre {
margin: 0;
}
}
}
}

@ -1,21 +0,0 @@
.devbar {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
font-family: monospace;
background-color: #ccc;
}
.devbar ol {
list-style-type: none;
padding: 0;
margin: 0;
}
.devbar ol li {
padding: .5rem;
border: 1px solid black;
margin: .5rem;
}
.devbar ol li pre {
margin: 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -147,7 +147,7 @@ document.addEventListener('DOMContentLoaded', function () {
const contents = tblRows(ctx.tbl).map(function (row) {
return Array.from(row.cells).reduce(function (carr, cell) {
return carr + cell.innerText.toLocaleLowerCase()
return carr + cell.textContent.toLocaleLowerCase()
}, "")
})
@ -237,7 +237,6 @@ document.addEventListener('DOMContentLoaded', function () {
function onSort(ctx, ix, event) {
const tbl = ctx.tbl
console.debug(tbl, ix, event)
const sortDir = event.target.getAttribute('data-sort') || 'asc'
const sortMod = sortDir === 'asc' ? -1 : 1;

File diff suppressed because one or more lines are too long

@ -0,0 +1,82 @@
document.addEventListener('DOMContentLoaded', function () {
const canvas = document.querySelector('.vis-canvas')
const nodes = new vis.DataSet([])
const edges = new vis.DataSet([])
const network = new vis.Network(canvas, {
nodes: nodes,
edges: edges
}, {
manipulation: true
})
const instanceLabel = (inst, schema) => `${inst.name}\n${schema.name}`
const addNode = (toAdd) => {
try {
nodes.add({
id: toAdd.uuid,
label: instanceLabel(toAdd, toAdd.schema)
})
} catch(e) {
console.debug(e)
}
}
const addOutEdges = (fromId, toAdd) => {
toAdd.forEach((inst) => {
try {
edges.add({
from: fromId,
to: inst.uuid,
label: inst['link-name'],
arrows: {
to: {enabled: true}
}
})
} catch (e) {
console.debug(e)
}
})
}
const addLinkedNodes = (toAdd) => {
toAdd.forEach((inst) => {
try {
console.debug(inst.name)
nodes.add({
id: inst.uuid,
label: instanceLabel(inst, inst.schema)
})
} catch (e) {
console.debug(e)
}
})
}
const addInstance = (instance) => {
addNode(instance)
addLinkedNodes(instance['links-out'])
addOutEdges(instance.uuid, instance['links-out'])
}
fetch(canvas.getAttribute('data-instance-url'))
.then((resp) => resp.json())
.then((json) => {
addInstance(json)
})
const searchForm = document.querySelector('.search')
const searchUrl = searchForm.getAttribute('action')
searchForm.addEventListener('submit', (event) => {
event.preventDefault()
const term = searchForm.querySelector('[name=term]').value
fetch(searchUrl + encodeURIComponent(term))
.then((resp) => resp.json())
.then((json) => {
console.debug(json)
json.forEach((inst) => {
addInstance(inst)
})
})
})
})

@ -0,0 +1,168 @@
(ns formulare.core
(:require [formulare.theme :as theme]
[clojure.spec.alpha :as spec]
[clojure.spec.test.alpha :as spectest]
[hiccup
[form :as hform]
[core :as hcore]]
[ring.util.anti-forgery :refer [anti-forgery-field]]))
(spec/def ::label string?)
(spec/def ::required boolean?)
(spec/def ::spec
(spec/or :registered-spec keyword?
:predicate ifn?))
(spec/def ::options
(spec/or :empty empty?
:options (spec/coll-of (spec/tuple string? string?))))
(spec/def ::widget
#{:input :select :checkbox :textarea :mselect :hidden :file})
(spec/def ::from-req ifn?)
(spec/def ::to-form ::from-req)
(spec/def ::attrs (spec/map-of keyword? (fn [_] true)))
(spec/def ::field
(spec/keys :opt-un [::label
::options
::widget
::from-req
::to-form
::required
::spec
::attrs]))
(spec/def ::fields
(spec/map-of keyword? ::field))
(spec/def ::form-specs
(spec/coll-of ::spec))
(spec/def ::form
(spec/keys :req-un [::fields]
:opt-un [::form-specs]))
(defn form-data [form-def req]
(reduce (fn [coll [id field]]
(let [value (get-in req [:params id])]
(assoc coll
id
(if-let [from-req (:from-req field)]
(from-req value)
value))))
{}
(:fields form-def)))
(spec/fdef form-data
:args (spec/cat :form-def ::form :req map?)
:ret map?)
(spectest/instrument `form-data)
(defn form-specs-valid? [form-def req]
(reduce (fn [valid? form-spec]
(if (spec/valid? form-spec req)
true
(reduced false)))
true
(:form-specs form-def)))
(defn field-specs-valid? [form-def req]
(reduce-kv
(fn [result field field-def]
(if-let [field-spec (:spec field-def)]
(if (spec/valid? field-spec (get-in req [:params field]))
true
(reduced false))
result))
true
(:fields form-def)))
(defn valid? [form-def req]
(let [data (form-data form-def req)]
(and (field-specs-valid? form-def req)
(form-specs-valid? form-def req))))
(spec/fdef valid?
:args (spec/cat :form-def ::form :req map?)
:ret map?)
(spectest/instrument `valid?)
(def ^:dynamic *row-theme* theme/row)
(def ^:dynamic *widget-error-theme* theme/widget-error)
(def ^:dynamic *form-error-theme* theme/form-error)
(def ^:dynamic *label-theme* theme/label)
(def ^:dynamic *input-widget-theme* theme/input-widget)
(def ^:dynamic *checkbox-widget-theme* theme/checkbox-widget)
(def ^:dynamic *textarea-widget-theme* theme/textarea-widget)
(def ^:dynamic *select-widget-theme* theme/select-widget)
(def ^:dynamic *mselect-widget-theme* theme/multiselect-widget)
(def ^:dynamic *hidden-widget-theme* theme/hidden-widget)
(def ^:dynamic *file-widget-theme* theme/file-widget)
(defn widget-markup [values req validate? [id def]]
(let [{:keys [spec widget to-form]} def
value ((or to-form identity) (id values))
req-value (get-in req [:params id])
renderer (case widget
:checkbox *checkbox-widget-theme*
:textarea *textarea-widget-theme*
:select *select-widget-theme*
:mselect *mselect-widget-theme*
:hidden *hidden-widget-theme*
:file *file-widget-theme*
*input-widget-theme*)]
(*row-theme* (when (and validate?
spec
(not (spec/valid? spec req-value)))
(*widget-error-theme* id def req-value))
(*label-theme* id def)
(renderer id def (if validate? req-value value)))))
(defn form-hash [form-def values]
(str (hash [form-def values])))
(defn validate? [form-def values req]
(= (form-hash form-def values)
(get-in req [:params :__form-hash])))
(defn render-widgets
([form-def values req]
(render-widgets form-def values req
{:render-anti-forgery-field? true}))
([form-def values req {raff? :render-anti-forgery-field?}]
(let [validate? (validate? form-def values req)
form-errors (when (and validate?
(not (form-specs-valid? form-def
req)))
(*form-error-theme* form-def req))
widget-mapper (partial widget-markup values req validate?)
defined-widgets (map widget-mapper (:fields form-def))
hash-field (hform/hidden-field "__form-hash"
(form-hash form-def values))
all-widgets (conj defined-widgets
hash-field)
all-widgets (if raff?
(conj all-widgets (anti-forgery-field))
all-widgets)]
(if form-errors
(concat (if (sequential? form-errors)
form-errors
[form-errors])
all-widgets)
all-widgets))))
(spec/def ::render-anti-forgery-field?
#(boolean? (boolean %)))
(spec/def ::options-map
(spec/keys :req-un
[::render-anti-forgery-field?]))
(spec/fdef render-widgets
:args (spec/or :three-params
(spec/cat :form-def ::form
:values (spec/or :no-values nil?
:values map?)
:req map?)
:four-params
(spec/cat :form-def ::form
:values (spec/or :no-values nil?
:values map?)
:req map?
:options ::options-map)))
(spectest/instrument `render-widgets)

@ -0,0 +1,85 @@
(ns formulare.theme
(:require [clojure.spec.alpha :as spec]
[hiccup
[form :as hform]
[core :as hcore]]))
(defn row [& content] content)
(defn err-msg [content]
[:section.flash--error
[:h2.flash__heading--error "Warning"]
content])
(defn widget-error [id field-def field-value]
(err-msg
(map
(fn [prob]
[:p
"Field "
[:span.flash__field
(hcore/h (:label field-def))]
" must comply to "
[:span.flash__pred
(hcore/h (:pred prob))]])
(:clojure.spec.alpha/problems
(spec/explain-data (:spec field-def)
field-value)))))
(defn form-error [form-def req]
(for [prob (mapcat #(:clojure.spec.alpha/problems
(spec/explain-data % req))
(:form-specs form-def))]
(err-msg [:p "The form must comply to "
(hcore/h (:pred prob))])))
(defn label [field-id field-def]
(when-not (= :hidden (:widget field-def))
(hform/label field-id (:label field-def))))
(defn input-widget [id def value]
(hform/text-field (merge {:required (or (:required def) false)}
(:attrs def))
id
value))
(defn checkbox-widget [id def value]
(hform/check-box id
(and (some? value)
(not= 0 value))
value))
(defn textarea-widget [id def value]
(hform/text-area (merge {:required (or (:required def) false)}
(:attrs def))
id
value))
(defn select-widget [id def value]
(hform/drop-down id
(:options def)
value))
(defn multiselect-widget [id def value]
[:select (merge {:multiple "multiple"
:size (:size def 5)
:name (name id)
:id (name id)}
(:attrs def))
(for [option (:options def)]
[:option {:value (second option)
:selected (some? (some (partial = (second option))
value))}
(hcore/h (first option))])])
(comment
(multiselect-widget :id {:options [["<>" "key"]]} {}))
(defn hidden-widget [id _ value]
(hform/hidden-field id value))
(defn file-widget [id def value]
[:input {:type :file
:name id
:required (or (:required def) false)
:value value}])

@ -1,42 +0,0 @@
module Explore exposing (Msg(..), main, update, view)
import Browser
import Html exposing (Html, button, div, node, text)
import Html.Attributes exposing (type_)
import Html.Events exposing (onClick)
main =
Browser.sandbox { init = 0, update = update, view = view }
type Msg
= Increment
| Decrement
update msg model =
case msg of
Increment ->
model + 1
Decrement ->
model - 1
withStyle html =
div []
[ node "style"
[ type_ "text/css" ]
[ text "@import url(/resources/public/css/app.css)" ]
, html
]
view model =
div []
[ button [ onClick Decrement ] [ text "-" ]
, div [] [ text (String.fromInt model) ]
, button [ onClick Increment ] [ text "+" ]
]
|> withStyle

@ -0,0 +1,95 @@
(ns wanijo.attribute.db
(:require [wanijo.infra.neo4j :as neo4j]))
(neo4j/defquery findy-by-schema
"MATCH (a:attribute)-->(s:schema)
WHERE s.uuid = $uuid
RETURN a
ORDER BY a.name")
(defn find-by-schema! [schema-uuid]
(map :a
(neo4j/exec-query!
findy-by-schema
{:uuid schema-uuid})))
(neo4j/defquery with-name-in-schema
"MATCH (a:attribute)-[:of]->(s:schema)
WHERE a.name = $name
AND s.uuid = $schema_uuid
RETURN a")
(defn with-name-in-schema! [matching-name schema-uuid]
(-> (neo4j/exec-query! with-name-in-schema
{:name matching-name
:schema_uuid schema-uuid})
first
:a))
(neo4j/defquery create-new
"MATCH (s:schema {uuid: $schema_uuid}),
(u:user {uuid: $user_uuid})
CREATE (a:attribute)
CREATE (a)-[:created_by]->(u)
CREATE (a)-[:of]->(s)
SET a.type = $type
SET a.name = $name
SET a.uuid = $attribute_uuid
SET a.required = $required
SET a.created_at = $created_at")
(defn create-new! [attr schema-uuid user-uuid]
(neo4j/exec-query!
create-new
(assoc attr
:user_uuid user-uuid
:schema_uuid schema-uuid
:attribute_uuid (neo4j/uuid)
:created_at (neo4j/now-str))))
(neo4j/defquery edit
"MATCH (a:attribute)
WHERE a.uuid = $uuid
SET a.type = $type
SET a.name = $name
SET a.required = $required")
(defn edit! [attr]
(neo4j/exec-query!
edit
attr))
(neo4j/defquery delete-by-uuid
"MATCH (a:attribute)-[c]-()
WHERE a.uuid = $uuid
DELETE c, a")
(defn delete-by-uuid! [uuid]
(neo4j/exec-query!
delete-by-uuid
{:uuid uuid}))
(neo4j/defquery required
"MATCH (a:attribute)-[:of]->(s:schema {uuid: $schema_uuid})
WHERE a.required = 1
RETURN a
ORDER BY a.name")
(defn required! [schema-uuid]
(map :a
(neo4j/exec-query! required
{:schema_uuid schema-uuid})))
(neo4j/defquery schema-of
"MATCH (a:attribute {uuid:{uuid}})-[:of]->(s:schema)
RETURN s")
(defn schema-of! [uuid]
(->> (neo4j/exec-query! schema-of
{:uuid uuid})
(map :s)
first))
(neo4j/defquery find-by-instance
"MATCH (i:instance {uuid: $instance_uuid}),
(i)-[:of]->(s:schema),
(a:attribute)-[:of]->(s)
RETURN a
ORDER BY a.name")
(defn find-by-instance! [instance-uuid]
(map :a
(neo4j/exec-query! find-by-instance
{:instance_uuid instance-uuid})))

@ -1,10 +1,9 @@
(ns wanijo.attribute.domain
(:require [clojure.spec.alpha :as spec]
[wanijo.specs :as specs]
[wanijo.framework.neo4j :as neo4j]))
(:require [wanijo.specs :as specs]
[clojure.spec.alpha :as spec]))
(def types
#{"string" "markdown"})
#{"string" "markdown" "file"})
(spec/def ::type types)
(spec/def ::name
(spec/and ::specs/name (complement empty?)))
@ -12,85 +11,3 @@
(spec/keys ::req-un [::name
::type
::specs/created-at]))
(neo4j/defquery
findy-by-schema
"MATCH (a:attribute)-->(s:schema)
WHERE s.uuid = {uuid}
RETURN a
ORDER BY a.name")
(defn find-by-schema! [schema-uuid]
(map :a
(neo4j/exec-query!
findy-by-schema
{:uuid schema-uuid})))
(neo4j/defquery create-new
"MATCH (s:schema {uuid:{schema_uuid}}),
(u:user {uuid:{user_uuid}})
CREATE (a:attribute)
CREATE (a)-[:created_by]->(u)
CREATE (a)-[:of]->(s)
SET a.type = {type}
SET a.name = {name}
SET a.uuid = {attribute_uuid}
SET a.required = {required}
SET a.created_at = {created_at}")
(defn create-new! [attr schema-uuid user-uuid]
(neo4j/exec-query!
create-new
(assoc attr
:user_uuid user-uuid
:schema_uuid schema-uuid
:attribute_uuid (neo4j/uuid)
:created_at (neo4j/now-str))))
(neo4j/defquery edit
"MATCH (a:attribute)
WHERE a.uuid = {uuid}
SET a.type = {type}
SET a.name = {name}
SET a.required = {required}")
(defn edit! [attr]
(neo4j/exec-query!
edit
attr))
(neo4j/defquery delete-by-uuid
"MATCH (a:attribute)-[c]-()
WHERE a.uuid = {uuid}
DELETE c, a")
(defn delete-by-uuid! [uuid]
(neo4j/exec-query!
delete-by-uuid
{:uuid uuid}))
(neo4j/defquery required
"MATCH (a:attribute)-[:of]->(s:schema {uuid:{schema_uuid}})
WHERE a.required = 1
RETURN a
ORDER BY a.name")
(defn required! [schema-uuid]
(map :a
(neo4j/exec-query! required
{:schema_uuid schema-uuid})))
(neo4j/defquery schema-of
"MATCH (a:attribute {uuid:{uuid}})-[:of]->(s:schema)
RETURN s")
(defn schema-of! [uuid]
(->> (neo4j/exec-query! schema-of
{:uuid uuid})
(map :s)
first))
(neo4j/defquery find-by-instance
"MATCH (i:instance {uuid:{instance_uuid}}),
(i)-[:of]->(s:schema),
(a:attribute)-[:of]->(s)
RETURN a
ORDER BY a.name")
(defn find-by-instance! [instance-uuid]
(map :a
(neo4j/exec-query! find-by-instance
{:instance_uuid instance-uuid})))

@ -3,11 +3,9 @@
[clojure.pprint :refer [pprint]]
[ring.util.response :as resp]
[formulare.core :as form]
[wanijo.framework.routing :refer [register! path]]
[wanijo.attribute.domain :as domain]
[wanijo.infra.routing :refer [register! path]]
[wanijo.attribute.db :as domain]
[wanijo.schema
[view :as schema-view]
[domain :as schema-domain]
[routes :as schema-routes]
[forms :as schema-forms]
[middleware :as schema-middleware]]))
@ -35,7 +33,7 @@
(resp/redirect (path :schema-show {:uuid (get-in req [:params :schema])})))
(defn wrap-allowed-to-write []
(schema-middleware/write-permission-middleware
(schema-middleware/write-permission-middleware!
#(or (get-in % [:params :schema])
(get-in % [:route-params :schema])
(-> (get-in % [:route-params :uuid])

@ -1,46 +0,0 @@
(ns wanijo.framework.devmode
(:require [hiccup.core :as hcore]
[clojure.string :as cljs]))
(def bar-entries (atom []))
(defn send-to-bar [msg]
(swap! bar-entries #(conj % msg)))
(defn devmode-on? [req]
(let [query-param (get-in req [:query-params "dev"])
cookie (get-in req [:cookies "devmode" :value])]
(or (= query-param "on")
(and (= cookie "1")
(not= query-param "off")))))
(defn devbar [resp]
(hcore/html
[:section.devbar
[:ol
(for [entry @bar-entries]
[:li [:pre entry]])]]))
(defn append-devbar [resp]
(let [body (:body resp)
new-body (cljs/replace
body "</body>" (str (devbar resp) "</body>"))]
(assoc resp :body new-body)))
(defn wrap-devmode [handler]
(fn [req]
(let [on? (devmode-on? req)
query-param? (get-in req [:query-params "dev"])
new-req (assoc-in req [:session :devmode] on?)
resp (handler new-req)
new-resp (cond
on? (-> resp
append-devbar
(assoc-in [:cookies :devmode] 1))
(some? query-param?) (assoc-in
resp
[:cookies :devmode]
(if on? 1 0))
:else resp)]
(reset! bar-entries [])
new-resp)))

@ -1,69 +0,0 @@
(ns wanijo.framework.neo4j
(:require [neo4j-clj.core :as db]
[wanijo.framework.devmode :as devmode]
[clj-time.format :as time-format]
[clj-time.local :as time-local]
[clojure.spec.alpha :as spec]
[clojure.string :as cljs])
(:import (java.util UUID)))
(spec/def ::date-str
#(re-matches #"\d{4}\d{2}\d{2}T\d{2}\d{2}\d{2}\.\d{3}Z" %))
(spec/def ::uuid
#(re-matches
#"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" %))
(def ^:dynamic *conn*
(let [env #(or (System/getenv %1) %2)
port (env "NEO4J_PORT" "7687")
host (env "NEO4J_HOST" "localhost")
user (env "NEO4J_USER" "neo4j")
pass (env "NEO4J_PASS" "b")]
(delay (db/connect
(str "bolt://" host ":" port)
user
pass))))
(defmacro defquery [& args] `(db/defquery ~@args))
(defn uuid []
(str (UUID/randomUUID)))
(defn butiful-query [qry]
(->> qry
str
cljs/trim-newline
cljs/split-lines
(map cljs/trim)
(filter #(pos? (count %)))
(cljs/join \newline)))
(defn exec-query! [qry params]
(with-open [session (db/get-session @*conn*)]
(devmode/send-to-bar
(str (butiful-query qry)
"<br>---Params---<br>"
params))
(qry session params)))
(spec/def ::tuple-query-list
(spec/coll-of
(spec/tuple fn? map?)))
(defn exec-queries! [& tuples]
{:pre [(spec/assert ::tuple-query-list tuples)]}
(db/with-transaction @*conn* tx
(doseq [tuple tuples]
(let [qry (first tuple)
params (second tuple)]
(devmode/send-to-bar
(str (butiful-query qry)
"<br>---Params---<br>"
params))
(spec/assert map? params)
(qry tx params)))))
(defn now-str []
(time-format/unparse
(time-format/formatters :basic-date-time)
(time-local/local-now)))

@ -1,84 +0,0 @@
(ns wanijo.framework.repl
(:require [buddy.hashers :as hashers]
[neo4j-clj.core :as db]
[wanijo.framework.neo4j :as neo4j]))
(db/defquery create-user
"CREATE (n:user)
SET n.ident = {ident}
SET n.pw = {pw}
SET n.uuid = {uuid}")
(defn create-user! [ident pw]
(neo4j/exec-query!
create-user
{:ident ident
:pw (hashers/derive pw)
:uuid (neo4j/uuid)}))
(db/defquery init-config
"MERGE (c:dbconfig)
ON CREATE SET
c.installed_at = {now},
c.db_version = 0")
(db/defquery config
"MATCH (c:dbconfig) RETURN c")
(db/defquery ver-0-schema-uuid
"CREATE CONSTRAINT ON (n:schema)
ASSERT n.uuid IS UNIQUE")
(db/defquery ver-0-attribute-uuid
"CREATE CONSTRAINT ON (n:attribute)
ASSERT n.uuid IS UNIQUE")
(db/defquery ver-0-instance-uuid
"CREATE CONSTRAINT ON (n:instance)
ASSERT n.uuid IS UNIQUE")
(db/defquery ver-0-property-uuid
"CREATE CONSTRAINT ON (n:property)
ASSERT n.uuid IS UNIQUE")
(db/defquery ver-0-user-uuid
"CREATE CONSTRAINT ON (n:user)
ASSERT n.uuid IS UNIQUE")
(db/defquery ver-0-link-uuid
"CREATE CONSTRAINT ON (n:link)
ASSERT n.uuid IS UNIQUE")
(db/defquery ver-1-tag-name
"CREATE CONSTRAINT ON (n:tag)
ASSERT n.name IS UNIQUE")
(db/defquery ver-1-tag-uuid
"CREATE CONSTRAINT ON (n:tag)
ASSERT n.uuid IS UNIQUE")
(defn init-version-0 []
(neo4j/exec-query! ver-0-schema-uuid {})
(neo4j/exec-query! ver-0-attribute-uuid {})
(neo4j/exec-query! ver-0-instance-uuid {})
(neo4j/exec-query! ver-0-property-uuid {})
(neo4j/exec-query! ver-0-user-uuid {})
(neo4j/exec-query! ver-0-link-uuid {}))
(defn init-version-1 []
(neo4j/exec-query! ver-1-tag-name {})
(neo4j/exec-query! ver-1-tag-uuid {}))
(def migrations
[init-version-0
init-version-1])
(defn run-migrations! []
(neo4j/exec-query! init-config {:now (neo4j/now-str)})
(let [version (-> (neo4j/exec-query! config {})
first
:c
:db_version)]
(if-let [to-run (nthrest migrations version)]
(doseq [mig to-run]
(mig)))))

@ -1,18 +0,0 @@
(ns wanijo.frontend.core
(:require
[reagent.core :as r]))
;; -------------------------
;; Views
(defn home-page []
[:div [:h2 "Welcome to Reagent ummf"]])
;; -------------------------
;; Initialize app
(defn mount-root []
(r/render [home-page] (.getElementById js/document "visualisation")))
(defn init! []
(mount-root))

@ -1,5 +1,6 @@
(ns wanijo.handler
(:require [compojure.core
(:require [clojure.string :refer [starts-with?]]
[compojure.core
:refer [defroutes routes]]
[compojure.route :as route]
[ring.middleware.defaults
@ -17,10 +18,11 @@
[wanijo.instance.routes :as instance-routes]
[wanijo.visualisation.routes :as vis-routes]
[wanijo.tag.routes :as tag-routes]
[wanijo.framework
[wanijo.infra
[auth :as auth]
[devmode :as devmode]
[routing :refer [path]]]))
[routing :refer [path]]
[gzip :as gzip]
[neo4j :as neo4j]]))
(defn- wrap-login-redirect [handler]
(fn [req]
@ -42,23 +44,24 @@
(def standalone-app
(-> app-routes
devmode/wrap-devmode
schema-middleware/wrap-user-schemas
(wrap-defaults site-defaults)))
schema-middleware/wrap-user-schemas!
ring-json/wrap-json-response
(wrap-defaults site-defaults)
gzip/wrap-gzip))
(defn wrap-spec-asserts [handler]
(fn [req]
(spec/check-asserts true)
(handler req)))
(def app
(def dev-app
(-> app-routes
wrap-spec-asserts
devmode/wrap-devmode
schema-middleware/wrap-user-schemas
schema-middleware/wrap-user-schemas!
ring-json/wrap-json-response
(wrap-defaults
(assoc-in site-defaults
[:session :store]
(session-cookie/cookie-store
{:key "1234567890123456"})))))
{:key (subs (neo4j/uuid) 0 16)})))
gzip/wrap-gzip))

@ -1,6 +1,6 @@
(ns wanijo.home.routes
(:require [compojure.core :refer [defroutes GET]]
[wanijo.framework.routing :refer [register!]]
[wanijo.infra.routing :refer [register!]]
[wanijo.home.view :as home-view]))
(defroutes routes

@ -1,5 +1,5 @@
(ns wanijo.home.view
(:require [wanijo.framework.view :as view]))
(:require [wanijo.infra.view :as view]))
(defn root! [req]
(view/layout! :session (:session req)))
(view/layout :request req))

@ -1,12 +1,12 @@
(ns wanijo.framework.auth
(ns wanijo.infra.auth
(:require [compojure.core :refer [POST GET defroutes]]
[ring.util.response :refer [redirect]]
[ring.util.anti-forgery :refer [anti-forgery-field]]
[buddy.hashers :as hashers]
[hiccup.form :as hform]
[wanijo.framework.view :as view]
[wanijo.framework.routing :refer [register! path]]
[wanijo.user.domain :as user-domain]))
[wanijo.infra.view :as view]
[wanijo.infra.routing :refer [register! path]]
[wanijo.user.db :as user-domain]))
(defn- login-check! [req]
(let [{{:keys [uname pw]} :params} req
@ -21,7 +21,7 @@
:flash :invalid-credentials))))
(defn login! [req]
(view/layout!
(view/layout
:content
[[:h1 "Login"]
(hform/form-to

@ -1,4 +1,4 @@
(ns wanijo.framework.common)
(ns wanijo.infra.common)
(defn in? [coll x]
(some? (some (partial = x) coll)))

@ -0,0 +1,77 @@
(ns wanijo.infra.gzip
(:require [clojure.java.io :as io])
(:import (java.io InputStream
Closeable
File
PipedInputStream
PipedOutputStream)
(java.util.zip GZIPOutputStream)))
(defn set-response-headers
[headers]
(if-let [vary (or (get headers "vary") (get headers "Vary"))]
(-> headers
(assoc "Vary" (str vary ", Accept-Encoding"))
(assoc "Content-Encoding" "gzip")
(dissoc "Content-Length" "content-length")
(dissoc "vary"))
(-> headers
(assoc "Vary" "Accept-Encoding")
(assoc "Content-Encoding" "gzip")
(dissoc "Content-Length" "content-length"))))
(defn accepts-gzip?
[req]
(if-let [accepts (get-in req [:headers "accept-encoding"])]
;; Be aggressive in supporting clients with mangled headers (due to
;; proxies, av software, buggy browsers, etc...)
(re-seq
#"(gzip\s*,?\s*(gzip|deflate)?|X{4,13}|~{4,13}|\-{4,13})"
accepts)))
(defn supported-response? [resp]
(let [{:keys [status headers body]} resp
min-bytes 859]
(and
;; correct status code
(#{200 201 202 203 204 205 403 404} status)
;; not already encoded
(not (or (headers "Content-Encoding")
(headers "content-encoding")))
;; correct data type in body
(or (string? body)
(seq? body)
(instance? InputStream body)
(and (instance? File body)
(re-seq #"(?i)\.(htm|html|css|js|json|xml)"
(pr-str body))))
;; sensible body sizes
(cond (string? body) (> (count body) min-bytes)
(seq? body) (> (count body) min-bytes)
(instance? File body) (> (.length body) min-bytes)
:else true))))
(defn compress-body [body]
(let [p-in (PipedInputStream.)
p-out (PipedOutputStream. p-in)]
(future
(with-open [out (GZIPOutputStream. p-out)]
(if (seq? body)
(doseq [string body] (io/copy (str string) out))
(io/copy body out)))
(when (instance? Closeable body)
(.close ^Closeable body)))
p-in))
(defn gzip-response [resp]
(-> resp
(update :headers set-response-headers)
(update :body compress-body)))
(defn wrap-gzip [handler]
(fn [req]
(let [resp (handler req)]
(if (and (accepts-gzip? req)
(supported-response? resp))
(gzip-response resp)
resp))))

@ -0,0 +1,96 @@
(ns wanijo.infra.neo4j
(:require [neo4j-clj.core :as db]
[neo4j-clj.in-memory :as db-inm]
[clj-time.format :as time-format]
[clj-time.local :as time-local]
[clojure.spec.alpha :as spec]
[clojure.string :as cljs]
[wanijo.infra.sysconfig :refer [env]])
(:import (java.util UUID)
(java.net URI)))
(spec/def ::date-str
#(re-matches #"\d{4}\d{2}\d{2}T\d{2}\d{2}\d{2}\.\d{3}Z" %))
(spec/def ::uuid
#(re-matches
#"[0-9a-f]+-[0-9a-f]+-[0-9a-f]+-[0-9a-f]+-[0-9a-f]+" %))
(def standard-port "7687")
(def standard-host "localhost")
(def standard-user "neo4j")
(def standard-pass "b")
(defn create-conn!
([]
(let [port (env "NEO4J_PORT" standard-port)
host (env "NEO4J_HOST" standard-host)
user (env "NEO4J_USER" standard-user)
pass (env "NEO4J_PASS" standard-pass)]
(create-conn! port host user pass)))
([port host user pass]
(db/connect
(URI. (str "bolt://" host ":" port))
user
pass)))
(def conn (atom nil))
(defn reset-conn!
([]
(reset! conn (create-conn!)))
([port host user pass]
(reset! conn (create-conn! port host user pass))))
(defn in-memory-conn! []
(reset! conn (db-inm/create-in-memory-connection)))
(defonce query-strings (atom {}))
(defmacro defquery [name query]
`(do (def ~name (db/create-query ~query))
(swap! wanijo.infra.neo4j/query-strings
assoc (hash ~name) ~query)))
(defn uuid []
(str (UUID/randomUUID)))
(defn butiful-query [qry]
(->> (get @query-strings (hash qry) "unknown query")
str
cljs/trim-newline
cljs/split-lines
(map cljs/trim)
(filter #(pos? (count %)))
(cljs/join \newline)))
(def log-queries (= "true" (env "LOG_QUERIES" "false")))
(comment (def log-queries true))
(defn exec-query! [qry params]
(let [live-conn (or @conn (reset-conn!))]
(with-open [session (db/get-session live-conn)]
(when log-queries
(println (butiful-query qry) \newline params \newline))
;; neo4j-clj returns lazy lists, but when we leave with-open,
;; the ResultSet (?) is already closed, so the list cannot
;; be processed
;; doall to the rescue to force the list to be evaluated
;; eagerly
(doall (qry session params)))))
(spec/def ::tuple-query-list
(spec/coll-of
(spec/tuple fn? map?)))
(defn exec-queries! [& tuples]
{:pre [(spec/assert ::tuple-query-list tuples)]}
(db/with-transaction @conn tx
(doseq [tuple tuples]
(let [qry (first tuple)
params (second tuple)]
(spec/assert map? params)
(qry tx params)))))
(defn now-str []
(time-format/unparse
(time-format/formatters :basic-date-time)
(time-local/local-now)))

@ -0,0 +1,138 @@
(ns wanijo.infra.repl
(:require [buddy.hashers :as hashers]
[wanijo.main :as main]
[wanijo.infra.neo4j :as neo4j]))
(neo4j/defquery create-user
"CREATE (n:user)
SET n.ident = $ident
SET n.pw = $pw
SET n.uuid = $uuid")
(defn create-user! [ident pw]
(neo4j/exec-query!
create-user
{:ident ident
:pw (hashers/derive pw)
:uuid (neo4j/uuid)}))
(neo4j/defquery init-config
"MERGE (c:dbconfig)
ON CREATE SET
c.installed_at = $now,
c.db_version = 0,
c.last_migration = ''")
(neo4j/defquery merge-config
"MATCH (c:dbconfig)
SET c.last_migration = $now,
c.db_version = {version}")
(neo4j/defquery config
"MATCH (c:dbconfig) RETURN c")
(neo4j/defquery ver-0-schema-uuid
"CREATE CONSTRAINT ON (n:schema)
ASSERT n.uuid IS UNIQUE")
(neo4j/defquery ver-0-attribute-uuid
"CREATE CONSTRAINT ON (n:attribute)
ASSERT n.uuid IS UNIQUE")
(neo4j/defquery ver-0-instance-uuid
"CREATE CONSTRAINT ON (n:instance)
ASSERT n.uuid IS UNIQUE")
(neo4j/defquery ver-0-property-uuid
"CREATE CONSTRAINT ON (n:property)
ASSERT n.uuid IS UNIQUE")
(neo4j/defquery ver-0-user-uuid
"CREATE CONSTRAINT ON (n:user)
ASSERT n.uuid IS UNIQUE")
(neo4j/defquery ver-0-link-uuid
"CREATE CONSTRAINT ON (n:link)
ASSERT n.uuid IS UNIQUE")
(neo4j/defquery ver-1-tag-name
"CREATE CONSTRAINT ON (n:tag)
ASSERT n.name IS UNIQUE")
(neo4j/defquery ver-1-tag-uuid
"CREATE CONSTRAINT ON (n:tag)
ASSERT n.uuid IS UNIQUE")
(defn init-version-0 []
(neo4j/exec-query! ver-0-schema-uuid {})
(neo4j/exec-query! ver-0-attribute-uuid {})
(neo4j/exec-query! ver-0-instance-uuid {})
(neo4j/exec-query! ver-0-property-uuid {})
(neo4j/exec-query! ver-0-user-uuid {})
(neo4j/exec-query! ver-0-link-uuid {}))
(defn init-version-1 []
(neo4j/exec-query! ver-1-tag-name {})
(neo4j/exec-query! ver-1-tag-uuid {}))
(neo4j/defquery migrate-links
"MATCH (i1:instance)-[lf:link_from]-(l:link)-[lt:link_to]-(i2:instance),
(l)-[cb:created_by]->(:user)
MERGE (i1)-[newl:link]->(i2)
ON CREATE SET
newl.name = l.name,
newl.created_at = l.created_at,
newl.uuid = l.uuid
DELETE cb, lf, lt, l")
(defn init-version-2 []
(neo4j/exec-query! migrate-links {}))
(neo4j/defquery migrate-permissions
"MATCH (s:schema)-[:created_by]->(u:user)
MERGE (u)-[:permission {type:'write'}]->(s)")
(defn init-version-3 []
(neo4j/exec-query! migrate-permissions {}))
(def migrations
[init-version-0
init-version-1
init-version-2
init-version-3])
(defn run-migrations! []
(neo4j/exec-query! init-config {:now (neo4j/now-str)})
(let [version (-> (neo4j/exec-query! config {})
first
:c
:db_version)]
(println "got version" version "from db," (count migrations) "available")
(when-let [to-run (nthrest migrations version)]
(println "running" (count to-run) "migrations")
(doseq [mig to-run]
(println "running" mig)
(mig))))
(neo4j/exec-query! merge-config {:now (neo4j/now-str)
:version (count migrations)})
nil)
(defn dev-server! []
(main/stop-server!)
(main/start-server-dev!)
(println "Started server at http://localhost:8080"))
(defn setup-in-memory! []
(neo4j/in-memory-conn!)
(create-user! "admin" "admin"))
(defn dev-env! []
(setup-in-memory!)
(dev-server!))
(comment
(dev-server!)
(setup-in-memory!)
(neo4j/reset-conn! "7688"
"mokoscha"
neo4j/standard-user
neo4j/standard-pass))

@ -1,4 +1,4 @@
(ns wanijo.framework.routing
(ns wanijo.infra.routing
(:require [clojure.string :as string]))
(def all-routes

@ -0,0 +1,7 @@
(ns wanijo.infra.sysconfig)
(defn env
([name]
(System/getenv name))
([name default]
(or (System/getenv name) default)))

@ -1,4 +1,4 @@
(ns wanijo.framework.time
(ns wanijo.infra.time
(:require [clj-time.format :as format]))
(defn prettify-dt [date-str]

@ -1,9 +1,8 @@
(ns wanijo.framework.view
(ns wanijo.infra.view
(:require [hiccup
[page :refer [html5 include-js include-css]]
[form :as hform]
[core :refer [h]]]
[wanijo.framework.routing :refer [path]]))
[wanijo.infra.routing :refer [path]]))
(defn btnlink
([target caption]
@ -14,39 +13,36 @@
caption]]))
(defn delete-btn []
(hform/submit-button {:class "delete-btn"}
"☒ Delete!"))
[:input {:type "submit"
:class "delete-btn"
:value "☒ Delete!"}])
(defn flash-error [content]
[:section.flash--error
[:h2.flash__heading--error "Warning"]
content])
(defn layout!
(defn layout
[& {:keys [content
title
session
request
head
bottom]
head]
:or {content []
title nil
request {}
session nil
bottom nil
head nil}}]
(let [session (or session (:session request))
ident (:ident session)
authed? (some? ident)
devmode? (:devmode session)]
authed? (some? ident)]
(html5
[:head
[:meta {:charset "utf-8"}]
[:meta {:name "viewport"
:content "width=device-width,initial-scale=1,shrink-to-fit=no"}]
[:title (str "wan ijo" (when title (str " - " title)))]
[:title (h (str (when title (str title " - ")) "wanijo"))]
(include-css "/css/app.css")
(when devmode? (include-css "/css/devmode.css"))
(include-js "/js/scripts.js")
head]
[:body
@ -91,5 +87,4 @@
(flash-error msg))]
content)
[:footer
[:small "Ilo pali e ijo"]]]
bottom])))
[:small "Ilo pali e ijo"]]]])))

@ -0,0 +1,259 @@
(ns wanijo.instance.db
(:require [clojure.spec.alpha :as spec]
[wanijo.infra.neo4j :as neo4j]
[wanijo.instance.domain :as domain-instance]
[wanijo.tag.db :as db-tag]
[wanijo.instance.revision.db :as db-rev]))
(neo4j/defquery findy-by-schema
"MATCH (i:instance)-[:of]->(s:schema)
WHERE s.uuid = $uuid
OPTIONAL MATCH
(i)-[:tagged_with]->(t:tag)
OPTIONAL MATCH
(i)<-[:of]-(p:property),
(p)-[:of]->(a:attribute)
RETURN i, t, p, a")
(defn flatten-grouped-rows [instance grouped-rows]
{:post [(spec/assert ::domain-instance/instance-with-tags-and-props %)]}
(assoc instance
:tags (->> grouped-rows
(map :t)
(filter some?)
distinct)
:properties (->> grouped-rows
(filter #(some? (:p %)))
(map #(assoc (:p %)
:attribute (:a %)))
distinct)))
(defn find-by-schema! [schema-uuid]
{:post [(spec/assert ::domain-instance/instances-with-tags-and-props %)]}
(->> (neo4j/exec-query! findy-by-schema
{:uuid schema-uuid})
(group-by :i)
(map #(flatten-grouped-rows (key %) (val %)))
(sort-by :name)))
(neo4j/defquery create-instance
"MATCH (s:schema {uuid: $schema_uuid}),
(u:user {uuid: $user_uuid})
CREATE (i:instance {uuid: $uuid})-[:of]->(s),
(i)-[:created_by]->(u)
SET i.name = $name,
i.created_at = $created_at,
i.updated_at = $created_at")
(neo4j/defquery create-property
"MATCH (i:instance {uuid: $uuid}),
(a:attribute {uuid: $attr_uuid})
CREATE (p:property {uuid: $prop_uuid})-[:of]->(i),
(p)-[:of]->(a)
SET p.value = $value,
p.created_at = $created_at,
p.updated_at = $updated_at")
(defn create! [user-uuid
schema-uuid
{:keys [name properties]}]
(let [instance-uuid (neo4j/uuid)
now (neo4j/now-str)
instance-tuple [create-instance
{:schema_uuid schema-uuid
:name name
:uuid instance-uuid
:created_at now
:user_uuid user-uuid}]
prop-tuples (for [{:keys [attribute value]} properties]
[create-property
{:uuid instance-uuid
:attr_uuid (:uuid attribute)
:prop_uuid (neo4j/uuid)
:value value
:created_at now
:updated_at now}])]
(apply neo4j/exec-queries!
(concat [instance-tuple]
prop-tuples))))
(neo4j/defquery find-by-uuid
"MATCH (i:instance {uuid: $uuid})-[:of]->(s:schema)
RETURN i, s")
(defn find-by-uuid! [uuid]
{:post [(spec/assert ::domain-instance/instance-with-schema %)]}
(->> (neo4j/exec-query! find-by-uuid
{:uuid uuid})
(map #(assoc (:i %)
:schema
(:s %)))
first))
(neo4j/defquery find-properties
"MATCH (i:instance {uuid: $uuid}),
(p:property)-[:of]->(i),
(p)-[:of]->(a:attribute)
RETURN p, a
ORDER BY a.name")
(defn find-properties! [uuid]
(map #(assoc (:p %)
:attribute
(:a %))
(neo4j/exec-query! find-properties
{:uuid uuid})))
(neo4j/defquery edit-instance
"MATCH (i:instance {uuid: $uuid})
SET i.name = $name,
i.updated_at = $updated_at")
(neo4j/defquery edit-property
"MATCH (i:instance {uuid: $instance_uuid}),
(a:attribute {uuid: $attribute_uuid})
MERGE (p:property {uuid: $uuid})-[:of]->(i)
MERGE (p)-[:of]->(a)
ON CREATE SET p.created_at = $now,
p.updated_at = $now,
p.value = $value
ON MATCH SET p.updated_at = $now,
p.value = $value")
(defn instance->prop-tuples [instance]
{:post [(spec/assert ::domain-instance/prop-tuple %)]}
(map (fn [prop]
(let [prop-uuid (:uuid prop)
uuid (if (empty? prop-uuid)
(neo4j/uuid)
prop-uuid)]
[edit-property
{:uuid uuid
:now (neo4j/now-str)
:value (:value prop)
:instance_uuid (:uuid instance)
:attribute_uuid (-> prop :attribute :uuid)}]))
(:properties instance)))
(defn edit! [instance revision]
(let [prop-tuples (instance->prop-tuples instance)]
(apply neo4j/exec-queries!
(concat [[edit-instance
{:uuid (:uuid instance)
:name (:name instance)
:updated_at (neo4j/now-str)}]]
prop-tuples
(db-rev/revision-queries revision)))))
(comment
(db-rev/revision-queries
{:instance-name "dings"
:instance-uuid "4711"
:properties [{:type "string"
:value "dings-prop"}]}))
(neo4j/defquery delete
"MATCH (i:instance {uuid: $uuid}),
(i)-[ic:of]->(s:schema),
(i)-[cb:created_by]->(:user)
OPTIONAL MATCH
(p:property)-[pc:of]->(i),
(p)-[pac:of]->(a:attribute)
OPTIONAL MATCH
(i)-[tw:tagged_with]->()
OPTIONAL MATCH
(i)-[l:link]-()
OPTIONAL MATCH
(i)<-[ric:of]-(rev:revision)
OPTIONAL MATCH
(rev_prop:rev_property)-[rpc:of]->(rev)
DELETE pac, pc, cb, ic, p,
l, tw, i, ric,
rpc, rev_prop, rev")
(defn delete! [uuid]
(neo4j/exec-query! delete {:uuid uuid}))
(defn group-by-link-and-assoc-tags [uuid query direction]
(->> (neo4j/exec-query! query {:uuid uuid})
(group-by #(hash-map :link (:link %)
:schema (:schema %)
direction (direction %)))
(map (fn [[link tags]]
(let [tags (map :tag tags)]
(assoc link
:tags (filter some? tags)))))
(sort-by (juxt #(-> % :schema :name)
#(-> % direction :name)
#(-> % direction :created_at)))))
(neo4j/defquery outgoing-links
"MATCH (inst:instance {uuid: $uuid}),
(inst)-[link:link]->(target:instance),
(target)-[:of]->(schema:schema)
OPTIONAL MATCH
(target)-[:tagged_with]->(tag:tag)
RETURN link, target, schema, tag")
(defn outgoing-links! [uuid]
{:post [(spec/assert ::domain-instance/links-out %)]}
(group-by-link-and-assoc-tags uuid outgoing-links :target))
(neo4j/defquery incoming-links
"MATCH (inst:instance {uuid: $uuid}),
(inst)<-[link:link]-(source:instance),
(source)-[:of]->(schema:schema)
OPTIONAL MATCH
(source)-[:tagged_with]->(tag:tag)
RETURN link, source, schema, tag
ORDER BY schema.name, source.name, source.created_at")
(defn incoming-links! [uuid]
{:post [(spec/assert ::domain-instance/links-in %)]}
(group-by-link-and-assoc-tags uuid incoming-links :source))
(defn full-instance-by-uuid! [uuid]
{:post [(spec/assert ::domain-instance/full-instance %)]}
(assoc (find-by-uuid! uuid)
:properties
(find-properties! uuid)
:links-out
(outgoing-links! uuid)
:links-in
(incoming-links! uuid)
:tags
(db-tag/tags-by-instance! uuid)))
(neo4j/defquery is-starred
"MATCH (u:user {uuid: $user_uuid}),
(i:instance {uuid: $uuid})
RETURN EXISTS((i)-[:starred_by]->(u)) AS starred")
(defn is-starred! [uuid user-uuid]
(-> (neo4j/exec-query! is-starred
{:user_uuid user-uuid
:uuid uuid})
first
:starred))
(neo4j/defquery mark-starred
"MATCH (i:instance {uuid: $uuid}),
(u:user {uuid: $user_uuid})
MERGE (i)-[s:starred_by]->(u)
ON CREATE
SET s.created_at = $now")
(defn mark-starred! [uuid user-uuid]
(neo4j/exec-query! mark-starred
{:uuid uuid
:user_uuid user-uuid
:now (neo4j/now-str)}))
(neo4j/defquery remove-starred
"MATCH (:instance {uuid: $uuid})
-[s:starred_by]->
(:user {uuid: $user_uuid})
DELETE s")
(defn remove-starred! [uuid user-uuid]
(neo4j/exec-query! remove-starred
{:uuid uuid
:user_uuid user-uuid}))
(neo4j/defquery starred-by-user
"MATCH (u:user {uuid: $user_uuid})
<-[s:starred_by]-
(i:instance)
RETURN i, s
ORDER BY s.created_at DESC")
(defn starred-by-user! [user-uuid]
(map #(assoc (:i %)
:starred_at (-> % :s :created_at))
(neo4j/exec-query! starred-by-user
{:user_uuid user-uuid})))

@ -1,123 +1,41 @@
(ns wanijo.instance.domain
(:require [clojure.spec.alpha :as spec]
[wanijo.specs :as specs]
[wanijo.framework.neo4j :as neo4j]
[wanijo.schema.domain :as domain-schema]
(:require [wanijo.specs :as specs]
[wanijo.attribute.domain :as domain-attr]
[wanijo.tag.domain :as domain-tag]))
[wanijo.schema.db :as db-schema]
[wanijo.tag.db :as db-tag]
[wanijo.link.db :as db-link]
[clojure.spec.alpha :as spec]))
(spec/def ::instance
(spec/keys :req-un [::neo4j/uuid
(spec/keys :req-un [::specs/uuid
::specs/created_at
::specs/updated_at
::specs/name]))
(spec/def ::properties
(spec/coll-of
(spec/keys :req-un [::neo4j/uuid
(spec/keys :req-un [::specs/uuid
::specs/created_at
::specs/updated_at
::domain-attr/attribute])))
(spec/def ::link
(spec/keys :req-un [::neo4j/uuid
::specs/created_at
::name]))
(spec/def ::target ::instance)
(spec/def ::source ::instance)
(spec/def ::links-out
(spec/coll-of
(spec/keys :req-un [::link
::target
::domain-schema/schema])))
(spec/def ::links-in
(spec/coll-of
(spec/keys :req-un [::link
::source
::domain-schema/schema])))
(spec/def ::tags
(spec/coll-of ::domain-tag/tag))
(spec/coll-of ::db-tag/tag))
(spec/def ::contains-schema
(spec/keys :req-un [::domain-schema/schema]))
(neo4j/defquery findy-by-schema
"MATCH (i:instance)-[:of]->(s:schema)
WHERE s.uuid = {uuid}
RETURN i
ORDER BY i.name")
(defn find-by-schema! [schema-uuid]
(map :i
(neo4j/exec-query!
findy-by-schema
{:uuid schema-uuid})))
(spec/keys :req-un [::db-schema/schema]))
(neo4j/defquery create-instance
"MATCH (s:schema {uuid:{schema_uuid}}),
(u:user {uuid:{user_uuid}})
CREATE (i:instance {uuid:{uuid}})-[:of]->(s),
(i)-[:created_by]->(u)
SET i.name = {name},
i.created_at = {created_at},
i.updated_at = {created_at}")
(neo4j/defquery create-property
"MATCH (i:instance {uuid:{uuid}}),
(a:attribute {uuid:{attr_uuid}})
CREATE (p:property {uuid:{prop_uuid}})-[:of]->(i),
(p)-[:of]->(a)
SET p.value = {value},
p.created_at = {created_at},
p.updated_at = {updated_at}")
(defn create! [user-uuid
schema-uuid
{:keys [name properties]}]
(let [instance-uuid (neo4j/uuid)
now (neo4j/now-str)
instance-tuple [create-instance
{:schema_uuid schema-uuid
:name name
:uuid instance-uuid
:created_at now
:user_uuid user-uuid}]
prop-tuples (for [{:keys [attribute value]} properties]
[create-property
{:uuid instance-uuid
:attr_uuid (:uuid attribute)
:prop_uuid (neo4j/uuid)
:value value
:created_at now
:updated_at now}])]
(apply neo4j/exec-queries!
(concat [instance-tuple]
prop-tuples))))
(spec/def ::instance-with-tags-and-props
(spec/merge ::instance
(spec/keys :req-un [::tags
::properties])))
(spec/def ::instances-with-tags-and-props
(spec/coll-of ::instance-with-tags-and-props))
(spec/def ::instance-with-schema
(spec/merge ::instance ::contains-schema))
(neo4j/defquery find-by-uuid
"MATCH (i:instance {uuid:{uuid}})
-[:of]->(s:schema)
RETURN i, s")
(defn find-by-uuid! [uuid]
{:post [(spec/assert ::instance-with-schema %)]}
(->> (neo4j/exec-query! find-by-uuid
{:uuid uuid})
(map #(assoc (:i %)
:schema
(:s %)))
first))
(neo4j/defquery find-properties
"MATCH (i:instance {uuid:{uuid}}),
(p:property)-[:of]->(i),
(p)-[:of]->(a:attribute)
RETURN p, a
ORDER BY a.name")
(defn find-properties! [uuid]
(map #(assoc (:p %)
:attribute
(:a %))
(neo4j/exec-query! find-properties
{:uuid uuid})))
(spec/def ::prop-tuple-values
(spec/keys :req-un [::neo4j/uuid
(spec/keys :req-un [::specs/uuid
::specs/now
::value
::specs/instance_uuid
@ -125,124 +43,20 @@
(spec/def ::prop-tuple
(spec/coll-of
(spec/tuple fn? ::prop-tuple-values)))
(neo4j/defquery edit-instance
"MATCH (i:instance {uuid:{uuid}})
SET i.name = {name},
i.updated_at = {updated_at}")
(neo4j/defquery edit-property
"MATCH (i:instance {uuid:{instance_uuid}}),
(a:attribute {uuid:{attribute_uuid}})
MERGE (p:property {uuid:{uuid}})-[:of]->(i)
MERGE (p)-[:of]->(a)
ON CREATE SET p.created_at = {now},
p.updated_at = {now},
p.value = {value}
ON MATCH SET p.updated_at = {now},
p.value = {value}")
(defn instance->prop-tuples [instance]
{:post [(spec/assert ::prop-tuple %)]}
(map (fn [prop]
(let [prop-uuid (:uuid prop)
uuid (if (empty? prop-uuid)
(neo4j/uuid)
prop-uuid)]
[edit-property
{:uuid uuid
:now (neo4j/now-str)
:value (:value prop)
:instance_uuid (:uuid instance)
:attribute_uuid (-> prop :attribute :uuid)}]))
(:properties instance)))
(defn edit! [instance]
(let [prop-tuples (instance->prop-tuples instance)]
(apply neo4j/exec-queries!
(concat [[edit-instance
{:uuid (:uuid instance)
:name (:name instance)
:updated_at (neo4j/now-str)}]]
prop-tuples))))
(neo4j/defquery delete
"MATCH (i:instance {uuid:{uuid}}),
(i)-[ic:of]->(s:schema),
(i)-[cb:created_by]->(:user)
OPTIONAL MATCH
(p:property)-[pc:of]->(i),
(p)-[pac:of]->(a:attribute)
OPTIONAL MATCH
(i)<-[lt1:link_to]-(ltn:link)-[lt2:link_from]->(),
(ltn)-[ltcb:created_by]->()
OPTIONAL MATCH
(i)<-[lf1:link_from]-(lfn:link)-[lf2:link_to]->(),
(lfn)-[lfcb:created_by]->()
OPTIONAL MATCH
(i)-[tw:tagged_with]->()
DELETE pac, pc, cb, ic, p,
lt1, lt2, ltn, ltcb,
lf1, lf2, lfn, lfcb,
tw, i")
(defn delete! [uuid]
(neo4j/exec-query! delete {:uuid uuid}))
(neo4j/defquery create-link
"MATCH (i:instance {uuid:{from}}),
(u:user {uuid:{by}}),
(t:instance {uuid:{target}})
CREATE (l:link {uuid:{uuid}})-[:created_by]->(u)
SET l.created_at = {created_at},
l.name = {name}
CREATE (i)<-[:link_from]-(l)-[:link_to]->(t)")
(defn create-link! [link]
(let [tuples (map (fn [target-uuid]
[create-link
{:from (:from link)
:by (:by link)
:target target-uuid
:uuid (neo4j/uuid)
:created_at (neo4j/now-str)
:name (:name link)}])
(:to link))]
(apply neo4j/exec-queries! tuples)))
(neo4j/defquery outgoing-links
"MATCH (i:instance {uuid:{uuid}}),
(i)<-[:link_from]-(l:link),
(l)-[:link_to]->(t:instance),
(t)-[:of]->(s:schema)
RETURN i, l, t, s
ORDER BY s.name, t.name, t.created_at")
(defn outgoing-links! [uuid]
{:post [(spec/assert ::links-out %)]}
(map (fn [row]
{:link (:l row)
:target (:t row)
:schema (:s row)})
(neo4j/exec-query! outgoing-links
{:uuid uuid})))
(neo4j/defquery incoming-links
"MATCH (i:instance {uuid:{uuid}}),
(i)<-[:link_to]-(l:link),
(l)-[:link_from]->(source:instance),
(source)-[:of]->(schema:schema)
RETURN i, l, source, schema
ORDER BY schema.name, source.name, source.created_at")
(defn incoming-links! [uuid]
{:post [(spec/assert ::links-in %)]}
(map (fn [row]
{:link (:l row)
:source (:source row)
:schema (:schema row)})
(neo4j/exec-query! incoming-links
{:uuid uuid})))
(spec/def ::links-out
(spec/coll-of
(spec/keys :req-un [::db-link/link
::target
::db-schema/schema
::tags])))
(neo4j/defquery delete-link
"MATCH (l:link {uuid:{uuid}}),
(l)-[r]-()
DELETE r, l")
(defn delete-link! [uuid]
(neo4j/exec-query! delete-link
{:uuid uuid}))
(spec/def ::links-in
(spec/coll-of
(spec/keys :req-un [::db-link/link
::source
::db-schema/schema
::tags])))
(spec/def ::contains-full-information
(spec/keys :req-un [::properties
@ -252,59 +66,12 @@
(spec/def ::full-instance
(spec/merge ::instance-with-schema
::contains-full-information))
(defn full-instance-by-uuid! [uuid]
{:post [(spec/assert ::full-instance %)]}
(assoc (find-by-uuid! uuid)
:properties
(find-properties! uuid)
:links-out
(outgoing-links! uuid)
:links-in
(incoming-links! uuid)
:tags
(domain-tag/tags-by-instance! uuid)))
(neo4j/defquery is-starred
"MATCH (u:user {uuid:{user_uuid}}),
(i:instance {uuid:{uuid}})
RETURN EXISTS((i)-[:starred_by]->(u)) AS starred")
(defn is-starred! [uuid user-uuid]
(-> (neo4j/exec-query! is-starred
{:user_uuid user-uuid
:uuid uuid})
first
:starred))
(neo4j/defquery mark-starred
"MATCH (i:instance {uuid:{uuid}}),
(u:user {uuid:{user_uuid}})
MERGE (i)-[s:starred_by]->(u)
ON CREATE
SET s.created_at = {now}")
(defn mark-starred! [uuid user-uuid]
(neo4j/exec-query! mark-starred
{:uuid uuid
:user_uuid user-uuid
:now (neo4j/now-str)}))
(neo4j/defquery remove-starred
"MATCH (:instance {uuid:{uuid}})
-[s:starred_by]->
(:user {uuid:{user_uuid}})
DELETE s")
(defn remove-starred! [uuid user-uuid]
(neo4j/exec-query! remove-starred
{:uuid uuid
:user_uuid user-uuid}))
(neo4j/defquery starred-by-user
"MATCH (u:user {uuid:{user_uuid}})
<-[s:starred_by]-
(i:instance)
RETURN i, s
ORDER BY s.created_at DESC")
(defn starred-by-user! [user-uuid]
(map #(assoc (:i %)
:starred_at (-> % :s :created_at))
(neo4j/exec-query! starred-by-user
{:user_uuid user-uuid})))
(defn to-revision [instance]
{:instance-name (:name instance)
:instance-uuid (:uuid instance)
:properties
(map (fn [{:keys [attribute value]}]
{:value value
:type (:type attribute)})
(:properties instance))})

@ -0,0 +1,50 @@
(ns wanijo.instance.files
(:require [clojure.java.io :as io]
[wanijo.infra.sysconfig :refer [env]]
[wanijo.infra.neo4j :refer [uuid]])
(:import [java.io File]))
(def files-home (str (env "WANIJO_HOME") "/files"))
(comment
(def files-home "/tmp/wanijo"))
(defn persist-files! [instance]
(doall
(for [file (->> (:properties instance)
(filter #(= "file" (-> % :attribute :type)))
(map (fn [prop] {:file (:value prop)
:uuid (:uuid prop)})))
:let [uploaded-file (:file file)
size (:size uploaded-file)
uuid (if (empty? (:uuid file)) (uuid) (:uuid file))
path (str files-home "/" uuid)]
:when (> size 0)]
(do
(.mkdirs (io/file files-home))
(io/copy (io/file (:tempfile uploaded-file)) (io/file path))
{:path path
:uuid uuid
:filename (:filename uploaded-file)
:content-type (:content-type uploaded-file)}))))
(comment
(let [instance {:name "Frank",
:properties
'({:attribute
{:name "Dateidings",
:created_at "20210929T154103.152Z",
:type "file",
:uuid "00847b4c-9961-47cd-a64f-18eaea0e362f",
:required 0},
:value
{:filename "2020.pdf",
:content-type "application/pdf",
:tempfile nil,
:size 127785},
:uuid "f7d56f9c-e74a-4b12-95c1-f33961672072"}),
:uuid "def4dacb-979f-4a0d-b1d6-535ac2a3f94b"}]
(->> (:properties instance)
(filter #(= "file" 1 #_(-> % :attribute :type))) #_(map (fn [prop] {:file (:value prop)
:uuid (:uuid prop)}))))
)

@ -1,6 +1,5 @@
(ns wanijo.instance.forms
(:require [wanijo.specs :as specs]
[wanijo.instance.domain :as domain]))
(:require [wanijo.specs :as specs]))
(def form
{:fields {:name {:label "Name"
@ -18,9 +17,24 @@
(:uuid %))
instances)}}})
(defn bulk-link-form [link-forms]
(map (fn [{:keys [schema form]}]
(let [name-field (keyword (str "name[" (:uuid schema) "]"))
instances-field (keyword (str "instances[" (:uuid schema) "]"))]
{:schema schema
:form (-> form
(assoc-in [:fields name-field]
(-> form :fields :name))
(update :fields dissoc :name)
(assoc-in [:fields instances-field]
(-> form :fields :instances))
(update :fields dissoc :instances))}))
link-forms))
(defn attr-type->widget [attr-type]
(case attr-type
("markdown" "text") :textarea
"file" :file
:input))
(defn attr->field-id [attr]

@ -0,0 +1,33 @@
(ns wanijo.instance.revision.db
(:require [wanijo.infra.neo4j :as neo4j]))
(neo4j/defquery save-revision
"MATCH (i:instance)
WHERE i.uuid = $uuid
CREATE (r:revision)-[:of]->(i)
SET r.uuid = $rev_uuid,
r.instance_name = $name,
r.created_at = $now")
(neo4j/defquery save-revision-property
"MATCH (r:revision)
WHERE r.uuid = $rev_uuid
CREATE (rp:rev_property)-[:of]->(r)
SET rp.uuid = $rp_uuid,
rp.value = $value,
rp.type = $type,
rp.created_at = $now")
(defn revision-queries [revision]
(let [rev-uuid (neo4j/uuid)]
(concat [[save-revision
{:uuid (:instance-uuid revision)
:rev_uuid rev-uuid
:name (:instance-name revision)
:now (neo4j/now-str)}]]
(map (fn [{:keys [value type]}]
[save-revision-property
{:rev_uuid rev-uuid
:rp_uuid (neo4j/uuid)
:value value
:type type
:now (neo4j/now-str)}])
(:properties revision)))))

@ -1,166 +1,251 @@
(ns wanijo.instance.routes
(:require [compojure.core :refer [defroutes wrap-routes
GET POST DELETE]]
GET POST DELETE]
:as compojure]
[ring.util.response :as resp]
[formulare.core :as form]
[wanijo.instance.view
[edit :refer [edit]]
[instances :refer [instances]]
[show :refer [show]]
[link-selection :refer [link-selection]]
[bulk-link-selection :refer [bulk-link-selection]]
[starred :refer [starred]]]
[wanijo.instance
[view :as view]
[db :as db]
[forms :as forms-inst]
[domain :as domain]
[forms :as forms-inst]]
[wanijo.schema
[domain :as domain-schema]
[middleware :as middleware-schema]]
[wanijo.framework.routing :refer [register! path]]
[wanijo.attribute.domain :as domain-attr]))
(defn list! [schema-uuid req]
(view/list! (domain-schema/find-by-uuid! schema-uuid)
(domain/find-by-schema! schema-uuid)
(forms-inst/with-attributes (domain-attr/required! schema-uuid))
[files :as files]]
[wanijo.schema.db :as domain-schema]
[wanijo.schema.middleware :as middleware-schema]
[wanijo.link.db :as domain-link]
[wanijo.infra.routing :refer [register! path]]
[wanijo.attribute.db :as db-attr]))
(defn route-list! [schema-uuid req]
(instances (domain-schema/find-by-uuid! schema-uuid)
(db/find-by-schema! schema-uuid)
(forms-inst/with-attributes (db-attr/required! schema-uuid))
req))
(defn new! [req]
(defn route-new! [req]
(let [schema-uuid (get-in req [:params :schema-uuid])
user-uuid (get-in req [:session :uuid])
req-attrs (domain-attr/required! schema-uuid)
req-attrs (db-attr/required! schema-uuid)
form-def (forms-inst/with-attributes req-attrs)]
(if (form/valid? form-def req)
(let [form-data (form/form-data form-def req)
req-attrs (domain-attr/required! schema-uuid)
req-attrs (db-attr/required! schema-uuid)
instance (forms-inst/form-data->instance form-data
req-attrs)]
(domain/create! user-uuid
(db/create! user-uuid
schema-uuid
instance)
(resp/redirect (path :instance-list
(:params req))))
(list! schema-uuid req))))
(route-list! schema-uuid req))))
(defn instance! [uuid]
(domain/full-instance-by-uuid! uuid))
(db/full-instance-by-uuid! uuid))
(defn show! [uuid req]
(defn route-show! [uuid req]
(let [user-uuid (-> req :session :uuid)
instance (assoc (instance! uuid)
:starred
(domain/is-starred! uuid
(db/is-starred! uuid
user-uuid))]
(view/show! instance
(show instance
(domain-schema/accessible-schemas! user-uuid)
req)))
(defn form! [uuid attrs]
(forms-inst/with-attributes attrs))
(defn edit-form! [uuid req]
(defn route-edit-form! [uuid req]
(let [instance (instance! uuid)
attrs (domain-attr/find-by-instance! uuid)
attrs (db-attr/find-by-instance! uuid)
user-uuid (get-in req [:session :uuid])]
(view/edit! instance
(form! uuid attrs)
(edit instance
(forms-inst/with-attributes attrs)
(forms-inst/instance->form-data instance)
(domain-schema/accessible-schemas! user-uuid)
req)))
(defn edit! [uuid req]
(let [attrs (domain-attr/find-by-instance! uuid)
form-def (form! uuid attrs)
instance (instance! uuid)]
(comment
(forms-inst/with-attributes
(db-attr/find-by-instance!
"def4dacb-979f-4a0d-b1d6-535ac2a3f94b")))
(defn route-edit! [uuid req]
(let [attrs (db-attr/find-by-instance! uuid)
form-def (forms-inst/with-attributes attrs)]
(if (form/valid? form-def req)
(let [form-data (form/form-data form-def req)
form-instance (forms-inst/form-data->instance form-data attrs)
instance (assoc form-instance :uuid uuid)]
(domain/edit! instance)
(db/edit! instance (domain/to-revision instance))
(resp/redirect (path :instance-show instance)))
(show! uuid req))))
(route-show! uuid req))))
(defn delete! [uuid req]
(defn route-delete! [uuid]
(let [schema (domain-schema/find-by-instance! uuid)]
(domain/delete! uuid)
(db/delete! uuid)
(resp/redirect (path :instance-list
{:schema-uuid (:uuid schema)}))))
(defn link-form! [schema-uuid]
(forms-inst/link-form
(domain/find-by-schema! schema-uuid)))
(db/find-by-schema! schema-uuid)))
(defn link-selection! [uuid schema-uuid req]
(view/link-selection (instance! uuid)
(defn route-link-selection! [uuid schema-uuid req]
(link-selection (instance! uuid)
(domain-schema/find-by-uuid! schema-uuid)
(link-form! schema-uuid)
req))
(defn create-link! [uuid schema-uuid req]
(defn route-create-link! [uuid schema-uuid req]
(let [form (link-form! schema-uuid)]
(if (form/valid? form req)
(let [form-data (form/form-data form req)]
(domain/create-link! {:from uuid
(domain-link/create! {:from uuid
:name (:name form-data)
:to (:instances form-data)
:by (get-in req [:session :uuid])})
(resp/redirect (path :instance-edit-form {:uuid uuid})))
(link-selection! uuid schema-uuid req))))
(route-link-selection! uuid schema-uuid req))))
(comment
(form/valid? (link-form! "6e7009e3-724b-4fce-afe0-7cf50f0bfcff")
{:params {:name "link-name"
:instances ["4bb90cc3-54d1-4d7d-bc30-c357777613ef"]}}))
(defn delete-link! [uuid link-uuid req]
(domain/delete-link! link-uuid)
(defn route-delete-link! [uuid link-uuid]
(domain-link/delete! link-uuid)
(resp/redirect (path :instance-edit-form {:uuid uuid})))
(defn mark-starred! [uuid req]
(domain/mark-starred! uuid
(defn route-mark-starred! [uuid req]
(db/mark-starred! uuid
(-> req :session :uuid))
(resp/redirect (path :instance-show {:uuid uuid})))
(defn remove-starred! [uuid req]
(domain/remove-starred! uuid
(defn route-remove-starred! [uuid req]
(db/remove-starred! uuid
(-> req :session :uuid))
(resp/redirect (path :instance-show {:uuid uuid})))
(defn list-starred! [req]
(view/list-starred
(domain/starred-by-user! (-> req :session :uuid))
(defn route-list-starred! [req]
(starred
(db/starred-by-user! (-> req :session :uuid))
req))
(defroutes routes
(defn route-bulk-link-selection! [uuid req]
(let [user-uuid (-> req :session :uuid)]
(bulk-link-selection (db/full-instance-by-uuid! uuid)
(->> (domain-schema/accessible-schemas!
user-uuid)
(map (fn [schema]
{:schema schema
:instances (db/find-by-schema!
(:uuid schema))})))
req)))
(defn route-create-bulk-link! [uuid req]
(let [names (-> req :params :name)
instances (-> req :params :instances)
source-uuid (-> req :params :source-uuid)]
; (clojure.pprint/pprint names)
; (clojure.pprint/pprint instances)
; (clojure.pprint/pprint source-uuid)
#_(clojure.pprint/pprint
(map (fn [[target-schema target-instances]]
{:link-name (get names target-schema)
:instances target-instances})
instances)))
(resp/redirect (path :instance-show {:uuid uuid})))
(defn schema-uuid-by-instance [req]
(-> (get-in req [:params :uuid])
(domain-schema/find-by-instance!)
:uuid))
(defn schema-uuid-from-params [req]
(get-in req [:params :schema-uuid]))
(def linking-routes
(-> (compojure/routes
(GET (register! :instance-link-selection
"/instance/:uuid/link/:schema-uuid")
[uuid schema-uuid :as req]
(route-link-selection! uuid schema-uuid req))
(POST (register! :instance-link-create
"/instance/:uuid/link/:schema-uuid")
[uuid schema-uuid :as req]
(route-create-link! uuid schema-uuid req)))
(wrap-routes
(GET (register! :instance-list "/instance/list/:schema-uuid")
[schema-uuid :as req]
(list! schema-uuid req))
(middleware-schema/wrap-allowed-to-read
(middleware-schema/wrap-allowed-to-write!
#(get-in % [:params :schema-uuid])))
(POST (register! :instance-new "/instance/new") []
new!)
(GET (register! :instance-show "/instance/:uuid")
[uuid :as req]
(show! uuid req))
(wrap-routes
(middleware-schema/wrap-allowed-to-write!
schema-uuid-by-instance))))
(def writing-routes-with-uuid-in-path
(wrap-routes
(compojure/routes
(GET (register! :instance-edit-form "/instance/:uuid/edit")
[uuid :as req]
(edit-form! uuid req))
(route-edit-form! uuid req))
(POST (register! :instance-edit "/instance/:uuid")
[uuid :as req]
(edit! uuid req))
(route-edit! uuid req))
(DELETE (register! :instance-delete "/instance/:uuid")
[uuid :as req]
(delete! uuid req))
(GET (register! :instance-link-selection
"/instance/:uuid/link/:schema-uuid")
[uuid schema-uuid :as req]
(link-selection! uuid schema-uuid req))
(POST (register! :instance-link-create
"/instance/:uuid/link/:schema-uuid")
[uuid schema-uuid :as req]
(create-link! uuid schema-uuid req))
[uuid]
(route-delete! uuid))
(DELETE (register! :instance-link-delete
"/instance/:uuid/link/:link-uuid")
[uuid link-uuid :as req]
(delete-link! uuid link-uuid req))
[uuid link-uuid]
(route-delete-link! uuid link-uuid))
(POST (register! :instance-mark-starred
"/instance/:uuid/starred")
[uuid :as req]
(mark-starred! uuid req))
(route-mark-starred! uuid req))
(DELETE (register! :instance-remove-starred
"/instance/:uuid/starred")
[uuid :as req]
(remove-starred! uuid req))
(route-remove-starred! uuid req))
(GET (register! :instance-bulk-link-selection "/instance/:uuid/bulk-link")
[uuid :as req]
(route-bulk-link-selection! uuid req))
(POST (register! :instance-bulk-link-create "/instance/:uuid/bulk-link")
[uuid :as req]
(route-create-bulk-link! uuid req)))
(middleware-schema/wrap-allowed-to-write!
schema-uuid-by-instance)))
(defroutes routes
;; read routes with :schema-uuid
(wrap-routes
(compojure/routes
(GET (register! :instance-list "/instance/list/:schema-uuid")
[schema-uuid :as req]
(route-list! schema-uuid req)))
(middleware-schema/wrap-allowed-to-read!
schema-uuid-from-params))
(wrap-routes
(compojure/routes
(GET (register! :instance-show "/instance/:uuid")
[uuid :as req]
(route-show! uuid req)))
(middleware-schema/wrap-allowed-to-read!
schema-uuid-by-instance))
(wrap-routes
(compojure/routes
(POST (register! :instance-new "/instance/new") []
route-new!))
(middleware-schema/wrap-allowed-to-write!
schema-uuid-from-params))
linking-routes
writing-routes-with-uuid-in-path
(GET (register! :instance-list-starred "/instance/starred/list")
[:as req]
(list-starred! req)))
;; at some point someone will star an instance and then permissions to
;; the schema will be revoked
;; the instances will still be visible but can't be opened anymore
;; because of missing permissions, so they can't be unstared anymore
(route-list-starred! req)))

@ -1,255 +0,0 @@
(ns wanijo.instance.view
(:require [hiccup
[form :as hform]
[core :refer [h]]]
[ring.util.anti-forgery :refer [anti-forgery-field]]
[markdown.core :as md]
[formulare.core :as form]
[wanijo.tag.view :as view-tag]
[wanijo.instance.domain :as domain]
[wanijo.visualisation.viz :as viz]
[wanijo.framework
[view :as view]
[routing :refer [path]]
[time :refer [prettify-dt]]]))
(defn list! [schema instances new-form req]
(view/layout!
:request req
:content
[[:h1 "All Instances of schema "
[:span.schema-title__name (h (:name schema))]]
[:h1 "New Instance"]
(hform/form-to [:post (path :instance-new)]
(form/render-widgets new-form {} req)
(hform/hidden-field "schema-uuid"
(:uuid schema))
(hform/submit-button "Create!"))
[:table
[:thead
[:tr
[:th "Name"]
[:th "Updated"]
[:th "Created"]]]
[:tbody
(for [instance instances]
[:tr
[:td
[:a {:href (path :instance-show instance)}
(h (:name instance))]]
[:td (prettify-dt (:updated_at instance))]
[:td (prettify-dt (:created_at instance))]])]]]))
(defn list-starred [instances req]
(view/layout!
:request req
:content
[[:h1 "Starred instances"]
[:table
[:thead
[:tr
[:th "Name"]
[:th "Starred"]
[:th "Updated"]
[:th "Created"]]]
[:tbody
(for [instance instances]
[:tr
[:td
[:a {:href (path :instance-show instance)}
(h (:name instance))]]
[:td (prettify-dt (:starred_at instance))]
[:td (prettify-dt (:updated_at instance))]
[:td (prettify-dt (:created_at instance))]])]]]))
(defn show! [instance schemas req]
(view/layout!
:request req
:content
[[:h1
(if (:starred instance)
(hform/form-to {:class "inline"}
[:delete (path :instance-mark-starred instance)]
(anti-forgery-field)
(hform/submit-button "★"))
(hform/form-to {:class "inline"}
[:post (path :instance-mark-starred instance)]
(anti-forgery-field)
(hform/submit-button "☆")))
"&nbsp;"
(h (-> instance :schema :name))
"&nbsp;"
[:small (h (:name instance))]]
[:p [:small
[:a {:href (path :instance-list
{:schema-uuid (-> instance :schema :uuid)})}
"Back to List"]
" | "
[:a {:href (path :instance-edit-form instance)}
"Edit Instance"]
" | "
[:a {:href (path :vis-explore {:instance-uuid (:uuid instance)})}
"Explore from here"]]]
(when (seq (:tags instance))
[:section.tags
(view-tag/tag-list (:tags instance))])
(when (seq (:properties instance))
[:section.properties
[:h2 "Properties"]
(for [prop (:properties instance)
:let [attr (:attribute prop)
type (:type attr)
render-fn (case type
"date" #(str (prettify-dt %))
"markdown" md/md-to-html-string
#(str "<p>" % "</p>"))]]
(list [:h3 (h (:name attr))]
[:div {:class (str "instance-content "
"attr-type-" type)}
(render-fn (:value prop))]))])
(when (or (seq (:links-out instance))
(seq (:links-in instance)))
[:section.visualisation
[:h2 "Visualisation"]
[:p (viz/single-instance instance)]])
(when (seq (:links-out instance))
[:section.links-out
[:h2 "Outgoing Links"]
[:table
[:thead
[:tr
[:th "Name"]
[:th "Instance"]
[:th "Schema"]
[:th "Created"]]]
[:tbody
(for [{:keys [link target schema]} (:links-out instance)
:let [name (:name link)
empty (empty? name)
name (if empty [:i "empty"] (h name))]]
[:tr
[:td name]
[:td [:a {:href (path :instance-show target)}
(h (:name target))]]
[:td [:a {:href (path :instance-list
{:schema-uuid (:uuid schema)})}
(h (:name schema))]]
[:td (prettify-dt (:created_at link))]])]]])
(when (seq (:links-in instance))
[:section.links-in
[:h2 "Incoming Links"]
[:table
[:thead
[:tr
[:th "Name"]
[:th "Instance"]
[:th "Schema"]
[:th "Created"]]]
[:tbody
(for [{:keys [link source schema]} (:links-in instance)
:let [name (:name link)
empty (empty? name)
name (if empty [:i "empty"] (h name))]]
[:tr
[:td name]
[:td [:a {:href (path :instance-show source)}
(h (:name source))]]
[:td [:a {:href (path :instance-list
{:schema-uuid (:uuid schema)})}
(h (:name schema))]]
[:td (prettify-dt (:created_at link))]])]]])
[:section.quick-edits
[:h2 "Quick edits"]
[:section.link-instance
[:h3 "Link Instance with Instance of Schema..."]
[:ul
(for [schema schemas]
[:li
[:a {:href (path :instance-link-selection
{:uuid (:uuid instance)
:schema-uuid (:uuid schema)})}
(h (:name schema))]])]]
[:section.tag-instance
[:h3 "Add or create Tags"]
(view-tag/new-tag-form instance)]]]))
(defn edit! [instance form form-data schemas req]
(view/layout!
:request req
:content
[[:h1
(h (-> instance :schema :name))
"&nbsp;"
[:small (h (:name instance))]]
[:p [:small
[:a {:href (path :instance-list
{:schema-uuid (-> instance :schema :uuid)})}
"Back to List"]
" | "
[:a {:href (path :instance-show instance)}
"Back to Instance"]]]
[:section.edit-instance
[:h2 "Edit Instance"]
(hform/form-to [:post (path :instance-edit instance)]
(form/render-widgets form form-data req)
(hform/submit-button "Edit!"))
(hform/form-to [:delete (path :instance-delete instance)]
(anti-forgery-field)
(view/delete-btn))]
(when (seq (:links-out instance))
[:section.links-out
[:h2 "Outgoing Links"]
[:table
[:thead
[:tr
[:th "Name"]
[:th "Instance"]
[:th "Schema"]
[:th "Created"]
[:th]]]
[:tbody
(for [{:keys [link target schema]} (:links-out instance)
:let [name (:name link)
empty (empty? name)
name (if empty [:i "empty"] (h name))]]
[:tr
[:td name]
[:td [:a {:href (path :instance-show target)}
(h (:name target))]]
[:td [:a {:href (path :instance-list
{:schema-uuid (:uuid schema)})}
(h (:name schema))]]
[:td (prettify-dt (:created_at link))]
[:td (hform/form-to [:delete (path :instance-link-delete
{:uuid (:uuid instance)
:link-uuid (:uuid link)})]
(anti-forgery-field)
(view/delete-btn))]])]]])
(when (seq (:tags instance))
[:section.tags
[:h2 "Tags"]
(view-tag/tag-table instance)])
[:section.link-instance
[:h2 "Link Instance with Instance of Schema..."]
[:ul
(for [schema schemas]
[:li
[:a {:href (path :instance-link-selection
{:uuid (:uuid instance)
:schema-uuid (:uuid schema)})}
(h (:name schema))]])]]]))
(defn link-selection [instance schema form req]
(view/layout!
:request req
:content
[[:h1
[:small "Link " (-> instance :schema :name) " "]
(h (:name instance))
[:small " with "]
(h (:name schema))]
(hform/form-to [:post (path :instance-link-create
{:uuid (:uuid instance)
:schema-uuid (:uuid schema)})]
(form/render-widgets form nil req)
(hform/submit-button "Link!"))]))

@ -0,0 +1,56 @@
(ns wanijo.instance.view.bulk-link-selection
(:require [hiccup.form :as hform]
[hiccup.core :refer [h]]
[wanijo.infra.view :as view]
[wanijo.infra.routing :refer [path]]
[wanijo.infra.time :refer [prettify-dt]]
[wanijo.instance.view.view
:refer [req-attrs-headings
req-attrs-cells
tags-for-search]]
[formulare.core :as form]
[ring.util.anti-forgery :refer [anti-forgery-field]]))
(defn bulk-link-selection [instance forms req]
(view/layout
:request req
:content
[[:h1
[:small "Link " (-> instance :schema :name h) " "]
(h (:name instance))
[:small " with..."]]
(hform/form-to
{:class "no-grid"}
[:post (path :instance-bulk-link-create instance)]
(anti-forgery-field)
(hform/hidden-field "source-uuid" (:uuid instance))
(for [{:keys [schema instances]} forms]
(list
[:h2 "Schema " (h (:name schema))]
(let [ident (str "name[" (:uuid schema) "]")]
[:div.sub-form
[:label {:for ident}
"Link name"]
[:input {:name ident :id ident}]])
[:table
[:thead
[:tr
[:th "Selection"]
[:th "Name"]
(req-attrs-headings schema)
[:th "Updated"]
[:th "Created"]]]
[:tbody
(for [inst instances]
[:tr
[:td {:style "text-align: center;"}
[:input {:type "checkbox"
:name (str "instances[" (:uuid schema) "]")
:value (:uuid inst)}]]
[:td (h (:name inst))
(tags-for-search inst)]
(req-attrs-cells schema inst)
[:td (-> inst :updated_at prettify-dt)]
[:td (-> inst :created_at prettify-dt)]])]]))
[:h2 "Actions"]
(hform/submit-button "Create links!"))]))

@ -0,0 +1,78 @@
(ns wanijo.instance.view.edit
(:require [hiccup.form :as hform]
[hiccup.core :refer [h]]
[ring.util.anti-forgery :refer [anti-forgery-field]]
[wanijo.infra.view :as view]
[wanijo.infra.routing :refer [path]]
[wanijo.infra.time :refer [prettify-dt]]
[wanijo.tag.view :as view-tag]
[formulare.core :as form]))
(defn edit [instance form form-data schemas req]
(view/layout
:request req
:title (str (:name instance) " - " (-> instance :schema :name))
:content
[[:h1
(h (-> instance :schema :name))
"&nbsp;"
[:small (h (:name instance))]]
[:p [:small
[:a {:href (path :instance-list
{:schema-uuid (-> instance :schema :uuid)})}
"Back to List"]
" | "
[:a {:href (path :instance-show instance)}
"Back to Instance"]]]
[:section.edit-instance
[:h2 "Edit Instance"]
[:form {:method "post"
:action (path :instance-edit instance)
:enctype "multipart/form-data"}
(form/render-widgets form form-data req)
(hform/submit-button "Edit!")]
(hform/form-to [:delete (path :instance-delete instance)]
(anti-forgery-field)
(view/delete-btn))]
(when (seq (:links-out instance))
[:section.links-out
[:h2 "Outgoing Links"]
[:table
[:thead
[:tr
[:th "Name"]
[:th "Instance"]
[:th "Schema"]
[:th "Created"]
[:th]]]
[:tbody
(for [{:keys [link target schema]} (:links-out instance)
:let [name (:name link)
empty (empty? name)
name (if empty [:i "empty"] (h name))]]
[:tr
[:td name]
[:td [:a {:href (path :instance-show target)}
(h (:name target))]]
[:td [:a {:href (path :instance-list
{:schema-uuid (:uuid schema)})}
(h (:name schema))]]
[:td (prettify-dt (:created_at link))]
[:td (hform/form-to [:delete (path :instance-link-delete
{:uuid (:uuid instance)
:link-uuid (:uuid link)})]
(anti-forgery-field)
(view/delete-btn))]])]]])
(when (seq (:tags instance))
[:section.tags
[:h2 "Tags"]
(view-tag/tag-table instance)])
[:section.link-instance
[:h2 "Link Instance with Instance of Schema..."]
[:ul
(for [schema schemas]
[:li
[:a {:href (path :instance-link-selection
{:uuid (:uuid instance)
:schema-uuid (:uuid schema)})}
(h (:name schema))]])]]]))

@ -0,0 +1,39 @@
(ns wanijo.instance.view.instances
(:require [hiccup.form :as hform]
[hiccup.core :refer [h]]
[formulare.core :as form]
[wanijo.instance.view.view :as view-instance]
[wanijo.infra.view :as view]
[wanijo.infra.routing :refer [path]]
[wanijo.infra.time :refer [prettify-dt]]))
(defn instances [schema instances new-form req]
(view/layout
:request req
:title (:name schema)
:content
[[:h1 "All Instances of schema "
[:span.schema-title__name (h (:name schema))]]
[:h1 "New Instance"]
(hform/form-to [:post (path :instance-new)]
(form/render-widgets new-form {} req)
(hform/hidden-field "schema-uuid"
(:uuid schema))
(hform/submit-button "Create!"))
[:table
[:thead
[:tr
[:th "Name"]
(view-instance/req-attrs-headings schema)
[:th "Updated"]
[:th "Created"]]]
[:tbody
(for [instance instances]
[:tr
[:td
[:a {:href (path :instance-show instance)}
(h (:name instance))]
(view-instance/tags-for-search instance)]
(view-instance/req-attrs-cells schema instance)
[:td (prettify-dt (:updated_at instance))]
[:td (prettify-dt (:created_at instance))]])]]]))

@ -0,0 +1,22 @@
(ns wanijo.instance.view.link-selection
(:require [hiccup.form :as hform]
[hiccup.core :refer [h]]
[wanijo.infra.view :as view]
[wanijo.infra.routing :refer [path]]
[formulare.core :as form]))
(defn link-selection [instance schema form req]
(view/layout
:request req
:title (str (:name instance) " - " (-> instance :schema :name))
:content
[[:h1
[:small "Link " (-> instance :schema :name h) " "]
(h (:name instance))
[:small " with "]
(h (:name schema))]
(hform/form-to [:post (path :instance-link-create
{:uuid (:uuid instance)
:schema-uuid (:uuid schema)})]
(form/render-widgets form nil req)
(hform/submit-button "Link!"))]))

@ -0,0 +1,112 @@
(ns wanijo.instance.view.show
(:require [hiccup.form :as hform]
[hiccup.core :refer [h]]
[ring.util.anti-forgery :refer [anti-forgery-field]]
[wanijo.infra.view :as view]
[wanijo.infra.routing :refer [path]]
[wanijo.infra.time :refer [prettify-dt]]
[wanijo.instance.view.view :as view-instance]
[wanijo.tag.view :as view-tag]
[markdown.core :as md]
[wanijo.visualisation.viz :as viz]))
(defn links-table [heading direction instance]
[:section.links-in
[:h2 (h heading)]
[:table
[:thead
[:tr
[:th "Name"]
[:th "Instance"]
[:th "Schema"]
[:th "Created"]]]
[:tbody
(for [{:keys [link source schema target] :as row} (direction instance)
:let [name (:name link)
empty (empty? name)
name (if empty [:i "empty"] (h name))
other (or source target)]]
[:tr
[:td name
(view-instance/tags-for-search row)]
[:td [:a {:href (path :instance-show other)}
(h (:name other))]]
[:td [:a {:href (path :instance-list
{:schema-uuid (:uuid schema)})}
(h (:name schema))]]
[:td (prettify-dt (:created_at link))]])]]])
(defn show [instance schemas req]
(view/layout
:request req
:title (str (:name instance) " - " (-> instance :schema :name))
:content
[[:h1
(if (:starred instance)
(hform/form-to {:class "inline"}
[:delete (path :instance-mark-starred instance)]
(anti-forgery-field)
(hform/submit-button "★"))
(hform/form-to {:class "inline"}
[:post (path :instance-mark-starred instance)]
(anti-forgery-field)
(hform/submit-button "☆")))
"&nbsp;"
(h (-> instance :schema :name))
"&nbsp;"
[:small (h (:name instance))]]
[:p [:small
[:a {:href (path :instance-list
{:schema-uuid (-> instance :schema :uuid)})}
"Back to List"]
" | "
[:a {:href (path :instance-edit-form instance)}
"Edit Instance"]
" | "
[:a {:href (path :vis-explore {:instance-uuid (:uuid instance)})}
"Explore from here"]
" | "
[:a {:href "#quick-edits"}
"Quick edits"]]]
(when (seq (:tags instance))
[:section.tags
(view-tag/tag-list (:tags instance))])
(when (seq (:properties instance))
[:section.properties
[:h2 "Properties"]
(for [prop (:properties instance)
:let [attr (:attribute prop)
type (:type attr)
render-fn (case type
"date" #(str (prettify-dt %))
"markdown" md/md-to-html-string
#(str "<p>" % "</p>"))]]
(list [:h3 (h (:name attr))]
[:div {:class (str "instance-content "
"attr-type-" type)}
(render-fn (:value prop))]))])
(when (or (seq (:links-out instance))
(seq (:links-in instance)))
[:section.visualisation
[:h2 "Visualisation"]
[:p (viz/single-instance instance)]])
(when (seq (:links-out instance))
(links-table "Outgoing links" :links-out instance))
(when (seq (:links-in instance))
(links-table "Incoming links" :links-in instance))
[:section.quick-edits
[:h2 {:id "quick-edits"} "Quick edits"]
[:section.link-instance
[:h3 "Link Instance with Instance of Schema..."]
[:ul
(for [schema schemas]
[:li
[:a {:href (path :instance-link-selection
{:uuid (:uuid instance)
:schema-uuid (:uuid schema)})}
(h (:name schema))]])]
[:a {:href (path :instance-bulk-link-selection instance)}
"Bulk create links"]]
[:section.tag-instance
[:h3 "Add or create Tags"]
(view-tag/new-tag-form instance)]]]))

@ -0,0 +1,27 @@
(ns wanijo.instance.view.starred
(:require [hiccup.core :refer [h]]
[wanijo.infra.view :as view]
[wanijo.infra.routing :refer [path]]
[wanijo.infra.time :refer [prettify-dt]]))
(defn starred [instances req]
(view/layout
:request req
:content
[[:h1 "Starred instances"]
[:table
[:thead
[:tr
[:th "Name"]
[:th "Starred"]
[:th "Updated"]
[:th "Created"]]]
[:tbody
(for [instance instances]
[:tr
[:td
[:a {:href (path :instance-show instance)}
(h (:name instance))]]
[:td (prettify-dt (:starred_at instance))]
[:td (prettify-dt (:updated_at instance))]
[:td (prettify-dt (:created_at instance))]])]]]))

@ -0,0 +1,21 @@
(ns wanijo.instance.view.view
(:require [hiccup.core :refer [h]]))
(defn tags-for-search [{tags :tags}]
[:span.tags-for-search
(reduce #(str %1 ":" (h (:name %2))) "" tags)])
(defn req-attrs-headings [{:keys [req-attrs]}]
(map (fn [attr] [:th (h (:name attr))])
req-attrs))
(defn req-attrs-cells [{:keys [req-attrs]}
{:keys [properties]}]
(map (fn [{attr-uuid :uuid}]
[:td (->> properties
(filter #(= attr-uuid
(-> % :attribute :uuid)))
first
:value
h)])
req-attrs))

@ -0,0 +1,37 @@
(ns wanijo.link.db
(:require [clojure.spec.alpha :as spec]
[wanijo.specs :as specs]
[wanijo.infra.neo4j :as neo4j]))
(spec/def ::link
(spec/keys :req-un [::neo4j/uuid
::specs/created_at
::name]))
(neo4j/defquery create
"MATCH (i:instance {uuid: $from}),
(t:instance {uuid: $target})
CREATE (i)-[l:link]->(t)
SET l.created_at = $created_at,
l.name = $name,
l.created_by = $by,
l.uuid = $uuid")
(defn create! [{:keys [from name to by]}]
(let [tuples (map (fn [target-uuid]
[create
{:from from
:by by
:target target-uuid
:uuid (neo4j/uuid)
:created_at (neo4j/now-str)
:name name}])
to)]
(apply neo4j/exec-queries! tuples)))
(neo4j/defquery delete
"MATCH (:instance)-[l:link]-(:instance)
WHERE l.uuid = {uuid}
DELETE l")
(defn delete! [uuid]
(neo4j/exec-query! delete
{:uuid uuid}))

@ -1,13 +1,13 @@
(ns wanijo.main
(:require [ring.adapter.jetty :refer [run-jetty]]
[wanijo.handler :as wanijo-handler])
[wanijo.handler :as wanijo-handler]
[nrepl.server :as nrepl])
(:gen-class))
(defonce server (atom nil))
(defn start-server!
[& {:keys [port
join?]
[& {:keys [port join?]
:or {port 3080
join? true}}]
(reset! server
@ -17,12 +17,21 @@
(defn start-server-dev! []
(start-server! :join? false
:port 8080))
:port 8080
:handler wanijo-handler/dev-app))
(defn stop-server []
(.stop @server))
(defn stop-server! []
(when @server
(.stop @server)))
(defn -main [& args]
(start-server! :port (Integer/valueOf (or (System/getenv "port")
"3080"))
:join? false))
(let [nrepl-port (Integer/valueOf (or (System/getenv "NREPL_PORT")
"7888"))
web-port (Integer/valueOf (or (System/getenv "WEB_PORT")
"3080"))]
(println "starting nrepl on port " nrepl-port)
(nrepl/start-server :port nrepl-port)
(println "starting web server on port " web-port)
(start-server! :port web-port
:join? false)))

@ -0,0 +1,207 @@
(ns wanijo.schema.db
(:require [wanijo.infra.neo4j :as neo4j]
[wanijo.schema.domain :as domain]
[clojure.spec.alpha :as spec]))
(neo4j/defquery all-readable-by
"MATCH (s:schema)-[p:permission]-(u:user)
WHERE u.uuid = $uuid
AND p.type IN ['read', 'write']
RETURN s
ORDER BY s.name")
(defn all-readable-by! [user-uuid]
(map :s
(neo4j/exec-query!
all-readable-by
{:uuid user-uuid})))
(neo4j/defquery all
"MATCH (s:schema)
RETURN s
ORDER BY s.name")
(defn all! []
(map :s
(neo4j/exec-query! all {})))
(neo4j/defquery create-new
"MATCH (u:user)
WHERE u.uuid = $u_uuid
CREATE (s:schema)-[:created_by]->(u)
SET s.name = $name
SET s.uuid = $s_uuid
SET s.created_at = $created_at
WITH u, s
CREATE (u)-[:permission {type:'write'}]->(s)
RETURN s")
(defn create-new! [schema-name user-uuid]
(->>
(neo4j/exec-query!
create-new
{:u_uuid user-uuid
:name schema-name
:s_uuid (neo4j/uuid)
:created_at (neo4j/now-str)})
first
:uuid))
(neo4j/defquery find-by-uuid
"MATCH (s:schema)
WHERE s.uuid = $uuid
OPTIONAL MATCH
(s)<-[:of]-(a:attribute)
WHERE a.required = 1
RETURN s, a
ORDER BY a.name")
(defn find-by-uuid! [uuid]
{:post [(spec/assert ::domain/schema-with-req-attrs %)]}
(let [result (neo4j/exec-query!
find-by-uuid
{:uuid uuid})
schema (:s (first result))]
(when schema
(assoc schema
:req-attrs (map :a result)))))
(neo4j/defquery schema-permissions
"MATCH (s:schema {uuid: $schema_uuid})
RETURN
EXISTS((:user {uuid: $user_uuid})
-[:permission {type: $type}]-
(s))
OR
EXISTS((:user {uuid : $user_uuid})
-[:permission {type: 'write'}]-
(s))
AS user_has_permission,
NOT EXISTS((:user)-[:permission]-(s)) AS is_public")
(defn has-user-permission? [perm-type schema-uuid user-uuid]
(let [perms (first
(neo4j/exec-query! schema-permissions
{:schema_uuid schema-uuid
:user_uuid user-uuid
:type perm-type}))]
(domain/has-user-permission? perms)))
(defn has-user-write-permissions? [schema-uuid user-uuid]
(has-user-permission? "write" schema-uuid user-uuid))
(defn has-user-read-permissions? [schema-uuid user-uuid]
(has-user-permission? "read" schema-uuid user-uuid))
(neo4j/defquery accessible-schemas
"MATCH (s:schema),
(u:user {uuid: $user_uuid})
WHERE EXISTS((u)-[:permission {type:'read'}]->(s))
OR NOT EXISTS((:user)-[:permission {type:'read'}]->(s))
WITH s
OPTIONAL MATCH
(s)<-[:of]-(a:attribute)
WHERE a.required = 1
RETURN s, COLLECT(a) AS a
ORDER BY s.name")
(defn accessible-schemas! [user-uuid]
{:post [(spec/assert ::domain/schema-with-req-attrs %)]}
(map (fn [{s :s a :a}]
(assoc s
:req-attrs (sort-by :name a)))
(neo4j/exec-query! accessible-schemas
{:user_uuid user-uuid})))
(neo4j/defquery delete
"MATCH (s:schema {uuid: $uuid})
WITH s
OPTIONAL MATCH (s)--(a:attribute)-[cb:created_by]-(:user)
DELETE cb, a
WITH s
MATCH (s)-[c]-()
DELETE c, s")
(defn delete! [uuid]
(neo4j/exec-query!
delete
{:uuid uuid}))
(neo4j/defquery edit
"MATCH (s:schema)
WHERE s.uuid = $uuid
SET s.name = $name")
(defn edit! [schema]
(neo4j/exec-query!
edit
schema))
(neo4j/defquery assigned-users
"MATCH (s:schema)-[p:permission]-(u:user)
WHERE s.uuid = $uuid
RETURN u, p
ORDER BY u.ident")
(defn assigned-users! [uuid]
(neo4j/exec-query!
assigned-users
{:uuid uuid}))
(neo4j/defquery assigned-schemas
"MATCH (s1:schema)-[p:permission]-(s2:schema)
WHERE s1.uuid = $uuid
RETURN s2
ORDER BY s2.name")
(defn assigned-schemas! [uuid]
(neo4j/exec-query!
assigned-schemas
{:uuid uuid}))
(defn find-with-assigned-entities! [uuid]
(let [users (reduce #(case (-> %2 :p :type)
"write" (update %1 :write conj (-> %2 :u :uuid))
"read" (update %1 :read conj (-> %2 :u :uuid))
%1)
{:write []
:read []}
(assigned-users! uuid))
schemas (map #(-> % :s2 :uuid) (assigned-schemas! uuid))]
(assoc (find-by-uuid! uuid)
:assigned-read-users (:read users)
:assigned-write-users (:write users)
:assigned-schemas schemas)))
(neo4j/defquery remove-assignments
"MATCH (s:schema)-[c:permission]-(:user)
WHERE s.uuid = $uuid
AND c.type = $permtype
DELETE c")
(neo4j/defquery create-assignments
"MATCH (s:schema), (u:user)
WHERE s.uuid = $uuid
AND u.uuid IN $users
CREATE (s)<-[:permission{type: $permtype}]-(u)")
(defn assign-users! [uuid users permission]
(neo4j/exec-queries!
[remove-assignments
{:uuid uuid
:permtype permission}]
[create-assignments
{:uuid uuid
:users users
:permtype permission}]))
(neo4j/defquery remove-schema-assignments
"MATCH (s1:schema)-[p:permission]-(s2:schema)
WHERE s1.uuid = $uuid
DELETE p")
(neo4j/defquery create-schema-assignments
"MATCH (s1:schema), (s2:schema)
WHERE s1.uuid = $uuid
AND s2.uuid IN $schemas
CREATE (s1)-[:permission]->(s2)")
(defn assign-schemas! [uuid schemas]
(neo4j/exec-queries!
[remove-schema-assignments
{:uuid uuid}]
[create-schema-assignments
{:uuid uuid :schemas schemas}]))
(neo4j/defquery find-by-instance
"MATCH (i:instance {uuid: $uuid})-[:of]->(s:schema)
RETURN s")
(defn find-by-instance! [uuid]
(-> find-by-instance
(neo4j/exec-query! {:uuid uuid})
first
:s))

@ -1,7 +1,8 @@
(ns wanijo.schema.domain
(:require [clojure.spec.alpha :as spec]
[wanijo.specs :as specs]
[wanijo.framework.neo4j :as neo4j]))
[wanijo.attribute.domain :as domain-attr]
[wanijo.infra.neo4j :as neo4j]))
(spec/def ::name
(spec/and ::specs/name (complement empty?)))
@ -14,199 +15,13 @@
::specs/created-at
::neo4j/uuid]))
(neo4j/defquery all-created-by
"MATCH (s:schema)-[:created_by]->(u:user)
WHERE u.uuid = {uuid}
RETURN s
ORDER BY s.name")
(defn all-created-by! [user-uuid]
(map :s
(neo4j/exec-query!
all-created-by
{:uuid user-uuid})))
(defn has-user-permission?
[{public? :is_public
user-permission :user_has_permission}]
(or public? user-permission))
(neo4j/defquery all
"MATCH (s:schema)
RETURN s
ORDER BY s.name")
(defn all! []
(map :s
(neo4j/exec-query! all {})))
(neo4j/defquery create-new
"MATCH (u:user)
WHERE u.uuid = {u_uuid}
CREATE (s:schema)-[:created_by]->(u)
SET s.name = {name}
SET s.uuid = {s_uuid}
SET s.created_at = {created_at}
RETURN s")
(defn create-new! [schema-name user-uuid]
(->>
(neo4j/exec-query!
create-new
{:u_uuid user-uuid
:name schema-name
:s_uuid (neo4j/uuid)
:created_at (neo4j/now-str)})
first
:uuid))
(neo4j/defquery find-by-uuid
"MATCH (s:schema)
WHERE s.uuid = {uuid}
RETURN s")
(defn find-by-uuid! [uuid]
(->>
(neo4j/exec-query!
find-by-uuid
{:uuid uuid})
first
:s))
(neo4j/defquery schema-creator
"MATCH (s:schema)-->(u:user)
WHERE s.uuid = {uuid}
RETURN u.uuid as uuid")
(defn find-schema-creator! [uuid]
(->>
(neo4j/exec-query!
schema-creator
{:uuid uuid})
first
:uuid))
(neo4j/defquery schema-permissions
"MATCH (s:schema {uuid:{schema_uuid}})
RETURN
EXISTS((:user {uuid:{user_uuid}})
-[:permission {type:{type}}]-
(s)) AS user_has_permission,
NOT EXISTS((:user)
-[:permission {type:{type}}]-
(s)) AS is_public")
(defn has-user-permission? [perm-type schema-uuid user-uuid]
(let [permissions (first (neo4j/exec-query! schema-permissions
{:schema_uuid schema-uuid
:user_uuid user-uuid
:type perm-type}))
public? (:is_public permissions)
user? (:user_has_permission permissions)]
(or public? user?)))
(defn has-user-write-permissions? [schema-uuid user-uuid]
(has-user-permission? "write" schema-uuid user-uuid))
(defn has-user-read-permissions? [schema-uuid user-uuid]
(has-user-permission? "read" schema-uuid user-uuid))
(neo4j/defquery accessible-schemas
"MATCH (s:schema),
(u:user {uuid:{user_uuid}})
WHERE EXISTS((u)-[:permission {type:'read'}]->(s))
OR NOT EXISTS((:user)-[:permission {type:'read'}]->(s))
RETURN s
ORDER BY s.name")
(defn accessible-schemas! [user-uuid]
(map :s
(neo4j/exec-query! accessible-schemas
{:user_uuid user-uuid})))
(neo4j/defquery delete
"MATCH (s:schema)
WHERE s.uuid = {uuid}
OPTIONAL MATCH (s)--(a:attribute)
DELETE a
WITH s
MATCH (s)-[c]-()
DELETE c, s")
(defn delete! [uuid]
(neo4j/exec-query!
delete
{:uuid uuid}))
(neo4j/defquery edit
"MATCH (s:schema)
WHERE s.uuid = {uuid}
SET s.name = {name}")
(defn edit! [schema]
(neo4j/exec-query!
edit
schema))
(neo4j/defquery assigned-users
"MATCH (s:schema)-[p:permission]-(u:user)
WHERE s.uuid = {uuid}
RETURN u, p
ORDER BY u.ident")
(defn assigned-users! [uuid]
(neo4j/exec-query!
assigned-users
{:uuid uuid}))
(neo4j/defquery assigned-schemas
"MATCH (s1:schema)-[p:permission]-(s2:schema)
WHERE s1.uuid = {uuid}
RETURN s2
ORDER BY s2.name")
(defn assigned-schemas! [uuid]
(neo4j/exec-query!
assigned-schemas
{:uuid uuid}))
(defn find-with-assigned-entities! [uuid]
(let [users (reduce #(case (-> %2 :p :type)
"write" (update %1 :write conj (-> %2 :u :uuid))
"read" (update %1 :read conj (-> %2 :u :uuid))
%1)
{:write []
:read []}
(assigned-users! uuid))
schemas (map #(-> % :s2 :uuid) (assigned-schemas! uuid))]
(assoc (find-by-uuid! uuid)
:assigned-read-users (:read users)
:assigned-write-users (:write users)
:assigned-schemas schemas)))
(neo4j/defquery remove-assignments
"MATCH (s:schema)-[c:permission]-(:user)
WHERE s.uuid = {uuid}
AND c.type = {permtype}
DELETE c")
(neo4j/defquery create-assignments
"MATCH (s:schema), (u:user)
WHERE s.uuid = {uuid}
AND u.uuid IN {users}
CREATE (s)<-[:permission{type:{permtype}}]-(u)")
(defn assign-users! [uuid users permission]
(neo4j/exec-queries!
[remove-assignments
{:uuid uuid
:permtype permission}]
[create-assignments
{:uuid uuid
:users users
:permtype permission}]))
(neo4j/defquery remove-schema-assignments
"MATCH (s1:schema)-[p:permission]-(s2:schema)
WHERE s1.uuid = {uuid}
DELETE p")
(neo4j/defquery create-schema-assignments
"MATCH (s1:schema), (s2:schema)
WHERE s1.uuid = {uuid}
AND s2.uuid IN {schemas}
CREATE (s1)-[:permission]->(s2)")
(defn assign-schemas! [uuid schemas]
(neo4j/exec-queries!
[remove-schema-assignments
{:uuid uuid}]
[create-schema-assignments
{:uuid uuid :schemas schemas}]))
(neo4j/defquery find-by-instance
"MATCH (i:instance {uuid:{uuid}})-[:of]->(s:schema)
RETURN s")
(defn find-by-instance! [uuid]
(-> find-by-instance
(neo4j/exec-query! {:uuid uuid})
first
:s))
(spec/def ::req-attrs
(spec/coll-of ::domain-attr/attribute))
(spec/def ::schema-with-req-attrs
(spec/merge ::schema
:req-un [::req-attrs]))

@ -1,21 +1,17 @@
(ns wanijo.schema.forms
(:require [wanijo.attribute.domain :as attr-domain]
(:require [wanijo.attribute.db :as db-attr]
[wanijo.attribute.domain :as domain-attr]
[wanijo.schema.domain :as domain-schema]
[clojure.string :refer [capitalize]]
[clojure.spec.alpha :as spec]))
(defn unique-attr-name-in-schema! [req]
(let [schema-uuid (get-in req [:params :schema])
attr-uuid (get-in req [:params :uuid])
(let [attr-uuid (get-in req [:params :uuid])
name (get-in req [:params :name])
duplicates (->> (attr-domain/find-by-schema! schema-uuid)
(map #(if (or (and (empty? attr-uuid)
(= name (:name %)))
(and (seq attr-uuid)
(= name (:name %))
(not= attr-uuid (:uuid %))))
1 0))
(apply +))]
(zero? duplicates)))
schema-uuid (get-in req [:params :schema])
matching-attr (db-attr/with-name-in-schema! name schema-uuid)]
(or (nil? matching-attr)
(= attr-uuid (:uuid matching-attr)))))
(spec/def ::unique-attr-name-per-schema
unique-attr-name-in-schema!)
@ -23,19 +19,19 @@
(def schema
{:fields {:name {:label "Name"
:required true
:spec :wanijo.schema.domain/name}
:spec ::domain-schema/name}
:uuid {:widget :hidden}}})
(def attr-form
{:fields {:name {:label "Name"
:required true
:spec ::attr-domain/name}
:spec ::domain-attr/name}
:type {:label "Type"
:required true
:spec ::attr-domain/type
:spec ::domain-attr/type
:widget :select
:options (map #(vector (capitalize %) %)
attr-domain/types)}
domain-attr/types)}
:required {:label "Required"
:required false
:widget :checkbox
@ -43,12 +39,15 @@
:uuid {:widget :hidden}}
:form-specs [::unique-attr-name-per-schema]})
(def assign-form
(defn assign-form [users]
{:fields {:assigned {:label "Users"
:required false
:spec :wanijo.schema.domain/assigned-to
:widget :mselect
:from-req #(if (vector? %) % [%])}
:from-req #(if (vector? %) % [%])
:options (map #(vector (:ident %) (:uuid %))
users)
:size (min 20 (count users))}
:uuid {:widget :hidden}}})
(def schema-connections-form

@ -1,41 +1,38 @@
(ns wanijo.schema.middleware
(:require [ring.util.response :as resp]
[wanijo.framework.routing :refer [path]]
[wanijo.schema.domain :as domain]))
[wanijo.infra.routing :refer [path]]
[wanijo.schema.db :as db]))
(defn wrap-user-schemas [handler]
(defn wrap-user-schemas! [handler]
(fn [req]
(if-let [uuid (get-in req [:session :uuid])]
(handler (assoc-in req
[:session :schemas]
(domain/accessible-schemas! uuid)))
(db/all-readable-by! uuid)))
(handler req))))
(defn write-permission-middleware [schema-fn]
(defn write-permission-middleware! [schema-fn]
(fn [handler]
(fn [req]
(let [uuid (schema-fn req)
check-fn domain/has-user-write-permissions?]
(if (check-fn uuid (get-in req [:session :uuid]))
(let [uuid (schema-fn req)]
(if (db/has-user-write-permissions? uuid (-> req :session :uuid))
(handler req)
(assoc
(resp/redirect (path :schema-show {:uuid uuid}))
:flash ["No write permission for schema"]))))))
(defn wrap-allowed-to-write []
(write-permission-middleware #(get-in % [:params :uuid])))
(defn wrap-allowed-to-read
(defn wrap-allowed-to-write!
([schema-fn]
(wrap-allowed-to-read schema-fn
(fn [_]
(assoc (resp/redirect (path :schema-overview))
:flash ["No read permission for schema"]))))
([schema-fn not-allowed-fn]
(write-permission-middleware! schema-fn))
([]
(write-permission-middleware! #(get-in % [:params :uuid]))))
(defn wrap-allowed-to-read!
[schema-fn]
(fn [handler]
(fn [req]
(let [uuid (schema-fn req)
check-fn domain/has-user-read-permissions?]
(if (check-fn uuid (get-in req [:session :uuid]))
(let [uuid (schema-fn req)]
(if (db/has-user-read-permissions? uuid (-> req :session :uuid))
(handler req)
(not-allowed-fn req)))))))
(assoc (resp/redirect (path :home))
:flash ["No read permission for schema"]))))))

@ -2,15 +2,14 @@
(:require [compojure.core :refer [defroutes GET POST DELETE] :as comp]
[ring.util.response :as resp]
[formulare.core :as form]
[wanijo.framework.view :as view]
[wanijo.framework.routing :refer [register! path]]
[wanijo.user.domain :as domain-user]
[wanijo.infra.routing :refer [register! path]]
[wanijo.user.db :as domain-user]
[wanijo.schema
[view :as schema-view]
[forms :as schema-forms]
[domain :as domain]
[db :as domain]
[middleware :as middleware]]
[wanijo.attribute.domain :as domain-attr]))
[wanijo.attribute.db :as db-attr]))
(defn new! [req]
(if (form/valid? schema-forms/schema req)
@ -21,18 +20,15 @@
(resp/redirect (path :schema-overview)))
(schema-view/overview! req)))
(defn delete-schema! [uuid session]
(defn delete-schema! [uuid]
(domain/delete! uuid)
(resp/redirect (path :schema-overview)))
(defn view! [uuid req]
(schema-view/show-schema!
(domain/find-with-assigned-entities! uuid)
(domain-attr/find-by-schema! uuid)
(assoc-in schema-forms/assign-form
[:fields :assigned :options]
(map #(vector (:ident %) (:uuid %))
(domain-user/all!)))
(db-attr/find-by-schema! uuid)
(schema-forms/assign-form (domain-user/all!))
(assoc-in schema-forms/schema-connections-form
[:fields :connections :options]
(map #(vector (:name %) (:uuid %))
@ -48,9 +44,10 @@
(view! uuid req))))
(defn assign-users! [req]
(let [{:keys [uuid assigned]} (form/form-data schema-forms/assign-form req)
(let [assign-form (schema-forms/assign-form (domain-user/all!))
{:keys [uuid assigned]} (form/form-data assign-form req)
permission (get-in req [:params :permission])]
(if (form/valid? schema-forms/assign-form req)
(if (form/valid? assign-form req)
(do
(domain/assign-users! uuid assigned permission)
(resp/redirect (path :schema-show (:params req))))
@ -73,8 +70,8 @@
(POST (register! :schema-assign-schemas "/schema/assign/schemas") []
assign-schemas!)
(DELETE (register! :schema-delete "/schema/:uuid")
[uuid :as req]
(delete-schema! uuid (:session req))))
[uuid]
(delete-schema! uuid)))
(defroutes read-routes
(GET (register! :schema-show "/schema/:uuid")
@ -87,7 +84,7 @@
(POST (register! :schema-new "/schema/new") []
new!)
(comp/wrap-routes read-routes
(middleware/wrap-allowed-to-read
(middleware/wrap-allowed-to-read!
#(get-in % [:route-params :uuid])))
(comp/wrap-routes write-routes
(middleware/wrap-allowed-to-write)))
(middleware/wrap-allowed-to-write!)))

@ -4,17 +4,17 @@
[core :refer [h]]]
[ring.util.anti-forgery :refer [anti-forgery-field]]
[formulare.core :as form]
[wanijo.framework.view :as view]
[wanijo.framework.routing :refer [path]]
[wanijo.framework.time :refer [prettify-dt]]
[wanijo.schema.domain :as domain]
[wanijo.infra.view :as view]
[wanijo.infra.routing :refer [path]]
[wanijo.infra.time :refer [prettify-dt]]
[wanijo.schema.db :as domain]
[wanijo.schema.forms :as forms]))
(defn overview! [req]
(let [session (:session req)
uuid (:uuid session)
schemas (domain/all-created-by! uuid)]
(view/layout!
schemas (domain/all-readable-by! uuid)]
(view/layout
:request req
:content
[[:h1 "All schemas"]
@ -37,7 +37,7 @@
(hform/submit-button "Create"))])))
(defn show-schema! [schema attrs assign-form conn-form req]
(view/layout!
(view/layout
:request req
:content
[[:h1 "Schema "
@ -50,7 +50,8 @@
[:h2 "Permissions"]
[:h3 "Read permissions"]
(hform/form-to [:post (path :schema-assign-users)]
(form/render-widgets assign-form
(form/render-widgets
assign-form
(assoc schema :assigned
(:assigned-read-users schema))
req)
@ -58,7 +59,8 @@
(hform/submit-button "Assign"))
[:h3 "Write permissions"]
(hform/form-to [:post (path :schema-assign-users)]
(form/render-widgets assign-form
(form/render-widgets
assign-form
(assoc schema :assigned
(:assigned-write-users schema))
req)

@ -1,6 +1,6 @@
(ns wanijo.specs
(:require [clojure.spec.alpha :as spec]
[wanijo.framework.neo4j :as neo4j]))
[wanijo.infra.neo4j :as neo4j]))
(spec/def ::created_at ::neo4j/date-str)
(spec/def ::updated_at ::neo4j/date-str)

@ -1,7 +1,7 @@
(ns wanijo.tag.domain
(ns wanijo.tag.db
(:require [clojure.spec.alpha :as spec]
[wanijo.specs :as specs]
[wanijo.framework.neo4j :as neo4j]))
[wanijo.infra.neo4j :as neo4j]))
(spec/def ::name
(spec/and ::specs/name
@ -12,7 +12,7 @@
::name]))
(neo4j/defquery tags-by-instance
"MATCH (i:instance {uuid:{uuid}})-[:tagged_with]->(t:tag)
"MATCH (i:instance {uuid: $uuid})-[:tagged_with]->(t:tag)
RETURN t
ORDER BY t.name")
(defn tags-by-instance! [instance-uuid]
@ -22,11 +22,11 @@
{:uuid instance-uuid})))
(neo4j/defquery merge-tag
"MATCH (i:instance {uuid:{instance_uuid}}),
(u:user {uuid:{user_uuid}})
MERGE (t:tag {name:{name}})-[:created_by]->(u)
ON CREATE SET t.uuid = {uuid},
t.created_at = {now}
"MATCH (i:instance {uuid: $instance_uuid}),
(u:user {uuid: $user_uuid})
MERGE (t:tag {name: $name})-[:created_by]->(u)
ON CREATE SET t.uuid = $uuid,
t.created_at = $now
MERGE (i)-[:tagged_with]->(t)")
(spec/def ::merge-tag-tuple
(spec/keys :req-un [::specs/instance_uuid
@ -59,9 +59,9 @@
(merge-tag-tuples tags instance-uuid user-uuid)))
(neo4j/defquery remove-tag
"MATCH (i:instance {uuid:{instance_uuid}})
"MATCH (i:instance {uuid: $instance_uuid})
-[c:tagged_with]->
(t:tag {uuid:{uuid}})
(t:tag {uuid: $uuid})
DELETE c")
(defn remove-tag! [uuid instance-uuid]
(neo4j/exec-query! remove-tag

@ -2,13 +2,12 @@
(:require [compojure.core :refer [defroutes POST DELETE]]
[ring.util.response :as resp]
[formulare.core :as form]
[wanijo.framework.routing :refer [register! path]]
[wanijo.schema.domain :as domain-schema]
[wanijo.instance
[view :as view-instance]
[domain :as domain-instance]]
[wanijo.infra.routing :refer [register! path]]
[wanijo.schema.db :as domain-schema]
[wanijo.instance.db :as db-instance]
[wanijo.instance.view.show :refer [show]]
[wanijo.tag
[domain :as domain]
[db :as domain]
[forms :as forms]]))
(defn create-tag! [instance-uuid req]
@ -21,8 +20,8 @@
user-uuid)
(resp/redirect (path :instance-show
{:uuid instance-uuid})))
(view-instance/show!
(domain-instance/full-instance-by-uuid! instance-uuid)
(show
(db-instance/full-instance-by-uuid! instance-uuid)
(domain-schema/accessible-schemas! user-uuid)
req))))

@ -4,7 +4,7 @@
[ring.util.anti-forgery :refer [anti-forgery-field]]
[formulare.core :as form]
[wanijo.tag.forms :as forms]
[wanijo.framework
[wanijo.infra
[routing :refer [path]]
[view :as view]
[time :refer [prettify-dt]]]))

@ -0,0 +1,51 @@
(ns wanijo.user.db
(:require [clojure.spec.alpha :as spec]
[wanijo.infra.neo4j :as neo4j]))
(spec/def ::ident
(spec/and string? not-empty))
(spec/def ::name
(spec/or :empty #(or (empty? %) (nil? %))
:given (spec/and string? some?)))
(spec/def ::password
(spec/and string? #(> 7 (count %))))
(neo4j/defquery
find-user
"MATCH (n:user)
WHERE n.ident = $ident
RETURN n")
(defn find! [ident]
(->>
(neo4j/exec-query!
find-user
{:ident ident})
first
:n))
(comment
(macroexpand '(db/defquery test-find-user
"MATCH (u:user) WHERE u.ident = $ident RETURN u"))
(macroexpand '(neo4j/defquery
find-user
"MATCH (n:user) WHERE n.ident = $ident RETURN n"))
(require '[neo4j-clj.core :as db])
(db/defquery test-find-user
"MATCH (u:user) WHERE u.ident = $ident RETURN u")
(with-open [s (db/get-session @neo4j/conn)]
(test-find-user s {:ident "admin"}))
(neo4j/exec-query! test-find-user {:ident "admin"}))
(neo4j/defquery
all
"MATCH (u:user)
RETURN u
ORDER BY u.ident")
(defn all! []
(map :u
(neo4j/exec-query!
all
{})))

@ -1,37 +0,0 @@
(ns wanijo.user.domain
(:require [clojure.spec.alpha :as spec]
[wanijo.framework.neo4j :as neo4j]))
(spec/def ::ident
(spec/and string? not-empty))
(spec/def ::name
(spec/or :empty #(or (empty? %) (nil? %))
:given (spec/and string? some?)))
(spec/def ::password
(spec/and string? #(> 7 (count %))))
(neo4j/defquery
find-user
"MATCH (n:user)
WHERE n.ident = {ident}
RETURN n")
(defn find! [ident]
(->>
(neo4j/exec-query!
find-user
{:ident ident})
first
:n))
(neo4j/defquery
all
"MATCH (u:user)
RETURN u
ORDER BY u.ident")
(defn all! []
(map :u
(neo4j/exec-query!
all
{})))

@ -1,9 +1,9 @@
(ns wanijo.user.routes
(:require [compojure.core :refer [defroutes GET POST]]
[ring.util.response :as resp]
[wanijo.framework.routing :refer [register!]]
[wanijo.infra.routing :refer [register!]]
[wanijo.user.view :as view-user]
[wanijo.user.domain :as domain]))
[wanijo.user.db :as domain]))
(defroutes routes
(GET

@ -2,9 +2,9 @@
(:require [hiccup.form :as hform]
[ring.util.anti-forgery :refer [anti-forgery-field]]
[formulare.core :as form]
[wanijo.framework.view :as view]
[wanijo.framework.routing :refer [path]]
[wanijo.user.domain :as domain]))
[wanijo.infra.view :as view]
[wanijo.infra.routing :refer [path]]
[wanijo.user.db :as domain]))
(def edit-form
{:fields {:ident {:label "Ident"
@ -12,7 +12,7 @@
:spec ::domain/ident}}})
(defn profile! [req user]
(view/layout!
(view/layout
:session (:session req)
:content
[[:h1 "Hi, " (get-in req [:session :ident])]

@ -0,0 +1,51 @@
(ns wanijo.visualisation.db
(:require [clojure.spec.alpha :as spec]
[wanijo.infra.neo4j :as neo4j]
[wanijo.instance.db :as db-instance]
[wanijo.instance.domain :as domain-instance]))
(spec/def ::link-name
(spec/or :not-give nil?
:given string?))
(spec/def ::links-out
(spec/coll-of
(spec/merge ::domain-instance/instance
(spec/keys :req-un [::link-name]))))
(spec/def ::with-enriched-out-links
(spec/merge ::domain-instance/instance
(spec/keys :req-un [::links-out])))
(neo4j/defquery all-instance-connections
"MATCH
(source:instance)-[:of]->(schema:schema)
OPTIONAL MATCH
(source)-[link:link]->(target:instance),
(target)-[:of]->(target_schema:schema)
RETURN source, schema, link, target, target_schema")
(defn all-instance-connections! []
(neo4j/exec-query! all-instance-connections {}))
(neo4j/defquery search
"MATCH (i:instance)
WHERE i.name =~ $term
RETURN i
LIMIT 10")
(defn enrich-links [instance]
(update instance
:links-out
(fn [links-in]
(map #(assoc
(db-instance/full-instance-by-uuid!
(-> % :target :uuid))
:link-name
(-> % :label :name))
links-in))))
(defn search! [term]
{:post [(spec/assert (spec/coll-of ::with-enriched-out-links) %)]}
(->> (neo4j/exec-query! search {:term (str ".*" term ".*")})
(map #(db-instance/full-instance-by-uuid! (-> % :i :uuid)))
(map enrich-links)))
(defn instance! [uuid]
{:post [(spec/assert ::with-enriched-out-links %)]}
(enrich-links (db-instance/full-instance-by-uuid! uuid)))

@ -1,13 +0,0 @@
(ns wanijo.visualisation.domain
(:require [wanijo.framework.neo4j :as neo4j]))
(neo4j/defquery all-instance-connections
"MATCH
(source:instance)-[:of]->(schema:schema)
OPTIONAL MATCH
(source)<-[:link_from]-(link:link)-[:link_to]->(target:instance),
(target)-[:of]->(target_schema:schema)
RETURN source, schema, link, target, target_schema")
(defn all-instance-connections! []
(neo4j/exec-query! all-instance-connections {}))

@ -1,34 +1,51 @@
(ns wanijo.visualisation.routes
(:require [compojure.core :refer [defroutes wrap-routes
GET POST DELETE]]
[ring.util.response :as resp]
[wanijo.framework.routing :refer [register! path]]
[wanijo.framework.view :as view]
[wanijo.instance.domain :as domain-instance]
[wanijo.schema.domain :as domain-schema]
[wanijo.infra
[routing :refer [register! path]]
[view :as view]]
[wanijo.instance.db :as db-instance]
[wanijo.schema.db :as domain-schema]
[wanijo.visualisation
[domain :as vis-domain]
[db :as vis-db]
[viz :as viz]
[view :as vis-view]]))
(defn all-instances [req]
(view/layout!
(view/layout
:request req
:content
[[:h1 "All Instances"]
(viz/all-instances (vis-domain/all-instance-connections!))]))
(viz/all-instances (vis-db/all-instance-connections!))]))
(defn all-schemas [req]
{:content-type "text/json"
:body (domain-schema/accessible-schemas! (-> req :session :uuid))})
(defn instance [uuid]
{:content-type "text/json"
:body (vis-db/instance! uuid)})
(defn search [term]
{:content-type "text/json"
:body (map #(merge %
{:urls {:instance (path :vis-get-instance %)}})
(vis-db/search! term))})
(defroutes routes
(GET (register! :vis-explore "/vis/explore/:instance-uuid")
[:as req]
(vis-view/index req))
[instance-uuid :as req]
(vis-view/index (db-instance/find-by-uuid! instance-uuid)
req))
(GET (register! :vis-all-instances "/vis/all-instances")
[:as req]
(all-instances req))
(GET (register! :vis-all-schemas "/api/vis/schemas")
[:as req]
(all-schemas req)))
(all-schemas req))
(GET (register! :vis-get-instance "/api/vis/instance/:uuid")
[uuid]
(instance uuid))
(GET (register! :vis-search-instance "/api/vis/search/:term")
[term]
(search term)))

@ -1,14 +1,23 @@
(ns wanijo.visualisation.view
(:require [hiccup.page :refer [include-js]]
[wanijo.framework.view :as view]))
(:require [hiccup.page :refer [include-js include-css]]
[hiccup.form :as hform]
[hiccup.core :refer [h]]
[wanijo.infra.routing :refer [path]]
[wanijo.infra.view :as view]))
(defn index [req]
(view/layout!
(defn index [instance req]
(view/layout
:request req
:head (include-js "/js/frontend.js")
:bottom [:script
"Elm.Main.init({node: document.getElementById('visualisation')})"]
:head (list (include-css "/css/vis-network.min.css")
(include-js "/js/vis-network.min.js"
"/js/vis.js"))
:content
[[:h1 "Visualisation"]
[:div#visualisation]
]))
[[:h1 "Explore instance " [:small (h (:name instance))]]
[:form.search {:action (path :vis-search-instance {:term ""})}
(hform/label "term" "Search Instance")
(hform/text-field {:autofocus true} "term")
[:input {:style "display: none" :type "submit"}]]
[:div.vis-canvas {:data-instance-url (path :vis-get-instance instance)}]
[:p.flash--warn
"Changes to the visualisation will not
(yet) mirror to the actual database"]]))

@ -3,7 +3,7 @@
[dorothy
[core :as dot]
[jvm :as doro-jvm]]
[wanijo.framework.routing :refer [path]]))
[wanijo.infra.routing :refer [path]]))
(defn node->label
([node]

@ -1,6 +1,6 @@
(ns wanijo.framework.routing-test
(ns wanijo.infra.routing-test
(:require [clojure.test :refer :all]
[wanijo.framework.routing :refer [parse-path]]))
[wanijo.infra.routing :refer [parse-path]]))
(deftest test-parse-path
(testing "no params in path"

@ -0,0 +1,189 @@
(ns wanijo.infra.system-test
(:require [clojure.test :refer [deftest testing is]]
[neo4j-clj.core :as drv]
[clojure.string :as string]
[wanijo.infra.neo4j :as neo4j]
[wanijo.infra.repl :as repl]
[wanijo.schema.routes :as schema-routes]
[wanijo.attribute.routes :as attr-routes]
[wanijo.instance.routes :as inst-routes]
[wanijo.instance.forms :as inst-forms]
[wanijo.instance.db :as inst-db]
[clojure.pprint :as pp]))
(defn single-result
([cypher]
(single-result cypher
#(val (first %))))
([cypher extractor]
(extractor
(first
(neo4j/exec-query!
(drv/create-query cypher) {})))))
(defn multi-results [cypher extractor]
(extractor
(neo4j/exec-query!
(drv/create-query cypher) {})))
(deftest allround-system-test
(repl/setup-in-memory!)
(def user
(single-result "MATCH (u:user) RETURN u"
:u))
(testing "create schema"
(schema-routes/new! {:params {:name "test-schema"}
:session {:uuid (:uuid user)}})
(def schema
(single-result "MATCH (s:schema) RETURN s LIMIT 1" :s))
(is (= "test-schema" (:name schema)))
(is (not= nil (:created_at schema)))
(is (= (:uuid user)
(single-result "MATCH (s:schema)-[:created_by]->(u:user)
RETURN u.uuid")))
(is (= (:uuid user)
(single-result "MATCH (s:schema)
<-[:permission {type:'write'}]-(u:user)
RETURN u.uuid"))))
(testing "create attribute"
(attr-routes/new! {:params {:schema (:uuid schema)
:name "test-attr"
:type "string"
:required "1"}
:session {:uuid (:uuid user)}})
(def attr
(single-result "MATCH (a:attribute) RETURN a"))
(is (= "string" (:type attr)))
(is (= "test-attr" (:name attr)))
(is (= 1 (:required attr)))
(is (= (:uuid user)
(single-result "MATCH (a:attribute)-[:created_by]->(u:user)
RETURN u.uuid")))
(is (= (:uuid schema)
(single-result "MATCH (a:attribute)-[:of]->(s:schema)
RETURN s.uuid"))))
(testing "assign read"
(schema-routes/assign-users! {:params {:uuid (:uuid schema)
:assigned [(:uuid user)]
:permission "read"}})
(is (= (list ["read" (:uuid user)] ["write" (:uuid user)])
(multi-results "MATCH (s:schema)
<-[p:permission]-(u:user)
RETURN p.type AS type, u.uuid AS uuid"
#(map (juxt :type :uuid) %)))))
(testing "create instance"
(inst-routes/route-new!
{:params {:schema-uuid (:uuid schema)
:name "instance"
(inst-forms/attr->field-id attr) "attr-value"}
:session {:uuid (:uuid user)}})
(def instance
(single-result "MATCH (i:instance) RETURN i"))
(is (= "attr-value"
(single-result "MATCH (p:property) RETURN p.value")))
(is (= (:uuid user)
(single-result "MATCH (i:instance)-[:created_by]->(u:user)
RETURN u.uuid")))
(let [full-inst (inst-db/full-instance-by-uuid! (:uuid instance))]
(is (= "attr-value"
(-> full-inst :properties first :value)))
(is (= (:uuid attr)
(-> full-inst :properties first :attribute :uuid)))
(is (empty? (:tags full-inst)))
(is (empty? (:links-in full-inst)))
(is (empty? (:links-out full-inst)))))
(testing "create second instance and linking"
(inst-routes/route-new!
{:params {:schema-uuid (:uuid schema)
:name "instance2"
(inst-forms/attr->field-id attr) "attr-value2"}
:session {:uuid (:uuid user)}})
(def instance2
(single-result "MATCH (i:instance)
WITH MAX(i.created_at) AS max_created_at
MATCH (i:instance)
WHERE i.created_at = max_created_at
RETURN i"))
(is (= "instance2" (:name instance2)))
(inst-routes/route-create-link!
(:uuid instance)
(:uuid schema)
{:params {:name "link-name"
:instances [(:uuid instance2)]}
:session {:uuid (:uuid user)}})
(let [link (single-result "MATCH ()-[l:link]-() RETURN l")]
(is (= "link-name" (:name link)))
(is (= (:uuid user) (:created_by link)))
(is (some? (:created_at link))))
(is (= (:uuid instance)
(single-result "MATCH (i:instance)-[:link]->(:instance)
RETURN i.uuid")))
(is (= (:uuid instance2)
(single-result "MATCH (i:instance)<-[:link]-(:instance)
RETURN i.uuid"))))
(testing "show instances"
(let [resp (inst-routes/route-show!
(:uuid instance)
{:session {:uuid (:uuid user)}})]
(is (true? (string? resp)))
(is (true? (string/includes? resp (:name instance))))
(is (true? (string/includes? resp (:name schema)))))
(let [resp (inst-routes/route-show!
(:uuid instance2)
{:session {:uuid (:uuid user)}})]
(is (true? (string? resp)))
(is (true? (string/includes? resp (:name instance))))
(is (true? (string/includes? resp (:name schema))))))
(testing "modifying first instance"
(let [prop-uuid (single-result
(str
"MATCH (i:instance)<-[:of]-(p:property)
WHERE i.uuid = '" (:uuid instance) "'
RETURN p.uuid"))]
(inst-routes/route-edit!
(:uuid instance)
{:params {:name "new-instance-1"
(inst-forms/attr->field-id attr) "new-value"
(inst-forms/attr->uuid-field-id attr) prop-uuid}
:session {:uuid (:uuid user)}})
(is (= "new-value"
(single-result
(str
"MATCH (p:property)
WHERE p.uuid = '" prop-uuid "'
RETURN p.value"))))
(is (= "new-value"
(single-result
(str
"MATCH (rp:rev_property)
-[:of]->(rev:revision)
-[:of]->(i:instance)
WHERE i.uuid = '" (:uuid instance) "'
RETURN rp.value"))))
(is (= 1 (single-result "MATCH (r:revision) RETURN COUNT(r)")))))
(testing "delete first instance"
(inst-routes/route-delete! (:uuid instance))
(is (= 1 (single-result "MATCH (i:instance) RETURN COUNT(i)")))
(is (= 1 (single-result "MATCH (p:property) RETURN COUNT(p)")))
(is (= 1 (single-result "MATCH (s:schema) RETURN COUNT(s)")))
(is (= 0 (single-result "MATCH ()-[l:link]-() RETURN COUNT(l)"))))
(testing "delete second instance"
(inst-routes/route-delete! (:uuid instance2))
(is (= 0 (single-result "MATCH (i:instance) RETURN COUNT(i)")))
(is (= 0 (single-result "MATCH (p:property) RETURN COUNT(p)")))
(is (= 1 (single-result "MATCH (s:schema) RETURN COUNT(s)")))))
(comment
(allround-system-test))

@ -1,13 +0,0 @@
(ns wanijo.instance.domain-test
(:require [clojure.test :refer :all]
[leiningen.neo4j :refer [with-test-db]]
[neo4j-clj.core :as db]
[wanijo.instance.domain :as domain]))
(deftest instances-are-created
(with-test-db
"/tmp"
(fn []
(binding [wanijo.framework.neo4j/*conn*
(atom (db/connect "bolt://localhost"))]
(println "jadda")))))
Loading…
Cancel
Save