├── .github └── workflows │ └── release.yml ├── .gitignore ├── Dockerfile ├── INSTALL-from-source.md ├── INSTALL-with-Docker.md ├── LICENSE.txt ├── NOTES.md ├── README.md ├── docker-compose.override.yml.template ├── docker-compose.yml ├── docker ├── launch.sh └── update.sh ├── nanodash.png ├── pom.xml ├── push-nanodash-test.sh ├── release.sh ├── run.sh ├── screenshot.png ├── src └── main │ ├── java │ └── com │ │ └── knowledgepixels │ │ └── nanodash │ │ ├── ApiCache.java │ │ ├── GrlcQuery.java │ │ ├── LookupApis.java │ │ ├── NanodashPageRef.java │ │ ├── NanodashPreferences.java │ │ ├── NanodashSession.java │ │ ├── NanopubElement.java │ │ ├── QueryApiAccess.java │ │ ├── RestrictedChoice.java │ │ ├── User.java │ │ ├── UserData.java │ │ ├── Utils.java │ │ ├── WicketApplication.java │ │ ├── action │ │ ├── ApprovalAction.java │ │ ├── CommentAction.java │ │ ├── DeriveAction.java │ │ ├── ImproveAction.java │ │ ├── NanopubAction.java │ │ ├── RetractionAction.java │ │ ├── UpdateAction.java │ │ ├── UseSameTemplateAction.java │ │ └── UseTemplateAction.java │ │ ├── component │ │ ├── ActionMenu.html │ │ ├── ActionMenu.java │ │ ├── ActivityPanel.html │ │ ├── ActivityPanel.java │ │ ├── AgentChoiceItem.html │ │ ├── AgentChoiceItem.java │ │ ├── ApiResultComponent.java │ │ ├── ComponentSequence.html │ │ ├── ComponentSequence.java │ │ ├── ContextComponent.java │ │ ├── DifferentKeyErrorItem.html │ │ ├── DifferentKeyErrorItem.java │ │ ├── ExploreDataTable.html │ │ ├── ExploreDataTable.java │ │ ├── GuidedChoiceItem.html │ │ ├── GuidedChoiceItem.java │ │ ├── HorizontalLine.html │ │ ├── HorizontalLine.java │ │ ├── InvalidityHighlighting.java │ │ ├── IriItem.html │ │ ├── IriItem.java │ │ ├── IriTextfieldItem.html │ │ ├── IriTextfieldItem.java │ │ ├── LiteralItem.html │ │ ├── LiteralItem.java │ │ ├── LiteralTextareaItem.html │ │ ├── LiteralTextareaItem.java │ │ ├── LiteralTextfieldItem.html │ │ ├── LiteralTextfieldItem.java │ │ ├── NanodashLink.html │ │ ├── NanodashLink.java │ │ ├── NanopubItem.html │ │ ├── NanopubItem.java │ │ ├── NanopubResults.html │ │ ├── NanopubResults.java │ │ ├── ProfileIntroItem.html │ │ ├── ProfileIntroItem.java │ │ ├── ProfileItem.html │ │ ├── ProfileItem.java │ │ ├── ProfileSigItem.html │ │ ├── ProfileSigItem.java │ │ ├── ProjectList.html │ │ ├── ProjectList.java │ │ ├── PubkeyItem.html │ │ ├── PubkeyItem.java │ │ ├── PublishForm.html │ │ ├── PublishForm.java │ │ ├── QueryList.html │ │ ├── QueryList.java │ │ ├── QueryParamField.html │ │ ├── QueryParamField.java │ │ ├── QueryResultTable.html │ │ ├── QueryResultTable.java │ │ ├── ReactionList.html │ │ ├── ReactionList.java │ │ ├── ReadonlyItem.html │ │ ├── ReadonlyItem.java │ │ ├── RestrictedChoiceItem.html │ │ ├── RestrictedChoiceItem.java │ │ ├── SequenceElementItem.html │ │ ├── SequenceElementItem.java │ │ ├── StatementItem.html │ │ ├── StatementItem.java │ │ ├── StatementPartItem.html │ │ ├── StatementPartItem.java │ │ ├── StatsPanel.html │ │ ├── StatsPanel.java │ │ ├── StatusLine.html │ │ ├── StatusLine.java │ │ ├── TemplateItem.html │ │ ├── TemplateItem.java │ │ ├── TemplateList.html │ │ ├── TemplateList.java │ │ ├── TemplateResults.html │ │ ├── TemplateResults.java │ │ ├── ThingListPanel.html │ │ ├── ThingListPanel.java │ │ ├── ThingResults.html │ │ ├── ThingResults.java │ │ ├── TitleBar.html │ │ ├── TitleBar.java │ │ ├── TripleItem.html │ │ ├── TripleItem.java │ │ ├── UserList.html │ │ ├── UserList.java │ │ ├── ValueItem.html │ │ ├── ValueItem.java │ │ ├── ValueTextfieldItem.html │ │ └── ValueTextfieldItem.java │ │ ├── connector │ │ ├── ConnectorConfig.java │ │ ├── ConnectorOption.java │ │ ├── ConnectorOptionGroup.java │ │ ├── ConnectorPage.java │ │ ├── GenConnectPage.html │ │ ├── GenConnectPage.java │ │ ├── GenNanopubPage.html │ │ ├── GenNanopubPage.java │ │ ├── GenOverviewPage.html │ │ ├── GenOverviewPage.java │ │ ├── GenPublishPage.html │ │ ├── GenPublishPage.java │ │ ├── GenSelectPage.html │ │ ├── GenSelectPage.java │ │ ├── ios │ │ │ ├── DsConfig.java │ │ │ ├── DsFormSubmit.png │ │ │ ├── DsLogo.png │ │ │ ├── DsNanopubPage.java │ │ │ └── DsOverviewPage.java │ │ └── pensoft │ │ │ ├── BdjConfig.java │ │ │ ├── BdjLogo.jpg │ │ │ ├── BdjLogo.svg │ │ │ ├── BdjNanopubPage.java │ │ │ ├── BdjOverviewPage.java │ │ │ ├── RioConfig.java │ │ │ ├── RioFormSubmit.png │ │ │ ├── RioLogo.svg │ │ │ ├── RioNanopubPage.java │ │ │ └── RioOverviewPage.java │ │ ├── page │ │ ├── ChannelPage.html │ │ ├── ChannelPage.java │ │ ├── ConnectorListPage.html │ │ ├── ConnectorListPage.java │ │ ├── ErrorPage.html │ │ ├── ErrorPage.java │ │ ├── ExplorePage.html │ │ ├── ExplorePage.java │ │ ├── FdoForwarder.java │ │ ├── GetNamePage.html │ │ ├── GetNamePage.java │ │ ├── GetViewPage.html │ │ ├── GetViewPage.java │ │ ├── GroupDemoPage.html │ │ ├── GroupDemoPage.java │ │ ├── GroupDemoPageSoc.html │ │ ├── GroupDemoPageSoc.java │ │ ├── HomePage.html │ │ ├── HomePage.java │ │ ├── MyChannelPage.java │ │ ├── NanodashPage.java │ │ ├── OrcidLinkingPage.html │ │ ├── OrcidLinkingPage.java │ │ ├── OrcidLoginPage.html │ │ ├── OrcidLoginPage.java │ │ ├── ProfilePage.html │ │ ├── ProfilePage.java │ │ ├── ProjectPage.html │ │ ├── ProjectPage.java │ │ ├── PublishConfirmPage.html │ │ ├── PublishConfirmPage.java │ │ ├── PublishPage.html │ │ ├── PublishPage.java │ │ ├── QueryListPage.html │ │ ├── QueryListPage.java │ │ ├── QueryPage.html │ │ ├── QueryPage.java │ │ ├── ReferenceTablePage.html │ │ ├── ReferenceTablePage.java │ │ ├── ResultTablePage.html │ │ ├── ResultTablePage.java │ │ ├── SearchPage.html │ │ ├── SearchPage.java │ │ ├── TermForwarder.java │ │ ├── TestPage.html │ │ ├── TestPage.java │ │ ├── ThingListPage.html │ │ ├── ThingListPage.java │ │ ├── TypePage.html │ │ ├── TypePage.java │ │ ├── UserListPage.html │ │ ├── UserListPage.java │ │ ├── UserPage.html │ │ ├── UserPage.java │ │ ├── ViewPage.html │ │ └── ViewPage.java │ │ ├── script │ │ └── nanodash.js │ │ └── template │ │ ├── ContextType.java │ │ ├── MalformedTemplateException.java │ │ ├── Template.java │ │ ├── TemplateContext.java │ │ ├── TemplateData.java │ │ ├── UnificationException.java │ │ └── ValueFiller.java │ ├── resources │ └── nanodash.properties │ └── webapp │ ├── WEB-INF │ └── web.xml │ ├── fonts │ ├── Inter-Light.woff2 │ ├── Inter-Medium.woff2 │ ├── MartianMono-StdLt.woff2 │ └── MartianMono-StdxLt.woff2 │ ├── images │ ├── api-icon.svg │ ├── by-kpxl.svg │ ├── down-arrow.svg │ ├── favicon.svg │ ├── form-icon.svg │ ├── hand-cursor.png │ ├── info.svg │ ├── logo.svg │ ├── orcid-linking-1.png │ ├── orcid-linking-2.png │ ├── orcid-linking-3.png │ ├── orcid-linking-4.png │ ├── refresh.svg │ └── user-icon.svg │ ├── nanopub-icon-colored-x.svg │ ├── nanopub-icon-colored.svg │ ├── nanopub-icon.svg │ ├── npback-left.png │ ├── scripts │ └── jquery.js │ └── style.css └── update-css-version.sh /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: "release" 2 | 3 | on: 4 | push: 5 | tags: 6 | - "nanodash-*" 7 | 8 | jobs: 9 | make-release: 10 | name: "Make release" 11 | runs-on: "ubuntu-latest" 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: Set up JDK 21 16 | uses: actions/setup-java@v1 17 | with: 18 | java-version: 21 19 | - name: Set envirnoment variable 20 | run: echo "NANODASH_VERSION=$(grep -oPm1 "(?<=)[^<]+" pom.xml)" >> $GITHUB_ENV 21 | 22 | - name: Package 23 | run: mvn package 24 | 25 | - uses: "marvinpinto/action-automatic-releases@latest" 26 | with: 27 | repo_token: "${{ secrets.GITHUB_TOKEN }}" 28 | automatic_release_tag: nanodash-${{ env.NANODASH_VERSION }} 29 | prerelease: false 30 | - name: Log in to Docker Hub 31 | uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 32 | with: 33 | username: tkuhn 34 | password: ${{ secrets.DOCKER_PASSWORD }} 35 | - name: Extract metadata (tags, labels) for Docker 36 | id: meta 37 | uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 38 | with: 39 | images: nanopub/nanodash 40 | - name: Build and push Docker image 41 | uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc 42 | with: 43 | context: . 44 | push: true 45 | tags: ${{ steps.meta.outputs.tags }} 46 | labels: ${{ steps.meta.outputs.labels }} 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.bak 3 | /.* 4 | /docker-compose.override.yml 5 | /local-data 6 | /target 7 | /package/.extract 8 | /scratch 9 | /*.tar.gz 10 | /*.tar.gz.enc 11 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM tomcat:11.0 2 | 3 | COPY target/nanodash-*.war /usr/local/tomcat/webapps/ROOT.war 4 | -------------------------------------------------------------------------------- /INSTALL-from-source.md: -------------------------------------------------------------------------------- 1 | Nanodash Installation from Sources 2 | ================================== 3 | 4 | You can also install Nanodash from the source code, you need to have [maven installed](https://maven.apache.org/install.html) to build the application. 5 | 6 | First clone the repository: 7 | 8 | ```bash 9 | git clone https://github.com/knowledgepixels/nanodash.git 10 | cd nanodash 11 | ``` 12 | 13 | ### Run for development 14 | 15 | Build and run Nanodash on http://localhost:37373 16 | 17 | ```bash 18 | mvn clean tomcat7:run 19 | ``` 20 | 21 | ### Build the jar 22 | 23 | Build the `.jar` using maven at the root of the repository: 24 | 25 | ```bash 26 | mvn clean install tomcat7:exec-war-only 27 | ``` 28 | 29 | It will generate a `.jar` and a `.war` file in the `target` folder 30 | 31 | Rename the jar: 32 | 33 | ```bash 34 | cp target/nanodash-*.jar target/nanodash.jar 35 | ``` 36 | 37 | Start Nanodash: 38 | 39 | ```bash 40 | java -jar target/nanodash.jar -httpPort 37373 -resetExtract 41 | ``` 42 | 43 | ## Problems? 44 | 45 | If you run into problems, [open an issue](https://github.com/knowledgepixels/nanodash/issues) or contact [Tobias Kuhn](mailto:kuhntobias@gmail.com). 46 | -------------------------------------------------------------------------------- /INSTALL-with-Docker.md: -------------------------------------------------------------------------------- 1 | Nanodash Installation Instructions with Docker 2 | =============================================== 3 | 4 | Nanodash is a client application that you can run on your own computer to browse and publish nanopublications by connecting to a decentralized network of services. 5 | 6 | 7 | ## Step 1: Install Docker and Docker Compose 8 | 9 | Make sure you have [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) installed. 10 | 11 | 12 | ## Step 2: Download and Run docker-compose.yml 13 | 14 | Download [docker-compose.yml](docker-compose.yml) to a convenient location in your file system. 15 | Then run `docker-compose up` on the command line in the same directory. 16 | 17 | 18 | ## Step 3: Follow Instructions 19 | 20 | After a few seconds, Nanodash will be accessible at [http://localhost:37373](http://localhost:37373) in your browser. 21 | Follow the instructions to complete your profile as shown on your [profile page](http://localhost:37373/profile). 22 | 23 | Now you are ready to publish your own nanopublications via the "publish" menu item at the top. 24 | 25 | 26 | ## Update 27 | 28 | To update to the latest version of Nanodash, run `docker-compose down && docker-compose pull` in the directory of `docker-compose.yml`. Then start Nanodash as in Step 2. 29 | 30 | 31 | ## Problems? 32 | 33 | If you run into problems, [open an issue](https://github.com/knowledgepixels/nanodash/issues) or contact [Tobias Kuhn](mailto:kuhntobias@gmail.com). 34 | -------------------------------------------------------------------------------- /NOTES.md: -------------------------------------------------------------------------------- 1 | Nanodash: Notes 2 | =============== 3 | 4 | ## Stylesheet update 5 | 6 | Copy stylesheet into running container: 7 | 8 | $ docker compose cp src/main/webapp/style.css nanodash:/usr/local/tomcat/webapps/ROOT/ 9 | 10 | 11 | ## Docker 12 | 13 | Make Docker container: 14 | 15 | $ package/package.sh 16 | $ docker build -t nanopub/nanodash . 17 | 18 | Publish Docker container: 19 | 20 | $ docker push nanopub/nanodash 21 | 22 | 23 | ## Release 24 | 25 | Prepare release: 26 | 27 | $ ./release.sh 28 | 29 | Perform release 30 | 31 | $ ./release.sh - 32 | 33 | 34 | ## Maven 35 | 36 | If Maven has problems with recent Java: 37 | 38 | $ export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/ 39 | 40 | 41 | ## Dependencies Report 42 | 43 | Run: 44 | 45 | $ mvn project-info-reports:dependencies 46 | 47 | Report is then generated here: target/site/dependencies.html 48 | 49 | 50 | ## Update Dependencies 51 | 52 | $ mvn versions:use-latest-versions && mvn versions:update-properties 53 | 54 | 55 | ## Backup archive of user data 56 | 57 | Make password-protected backup file of user data (private keys): 58 | 59 | $ tar -czv local-data/nanodash-users/ | openssl enc -aes-256-cbc -e > nanodash-users.tar.gz.enc 60 | 61 | Decrypt and extract: 62 | 63 | $ openssl aes-256-cbc -d -in nanodash-users.tar.gz.enc | tar -xzv 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Nanodash 2 | ======== 3 | 4 | ![logo](nanodash.png) 5 | 6 | Nanodash was previously called Nanobench. 7 | 8 | Nanodash is a client to browse and publish nanopublications. 9 | 10 | 11 | ### Online Instances 12 | 13 | You can use Nanodash by login in via ORCID in one of the online instances: 14 | 15 | - https://nanodash.petapico.org/ 16 | - https://nanodash.knowledgepixels.com/ 17 | - https://nanodash.np.trustyuri.net/ 18 | 19 | 20 | ### Local Installation 21 | 22 | To use Nanodash locally, see the [installation instructions with Docker](INSTALL-with-Docker.md). 23 | 24 | 25 | ### Screenshot 26 | 27 | This screenshot of Nanodash is showing its publishing feature with auto-complete-powered forms generated from semantic templates: 28 | 29 | ![screenshot of Nanodash showing the publishing feature](screenshot.png) 30 | 31 | 32 | ### Tutorials 33 | 34 | [This demo](https://knowledgepixels.com/nanopub-demo/) gives you a quick hands-on introduction into nanopublications via the Nanodash interface, including a video: 35 | 36 | - [Demo video on nanopublications and Nanodash](https://youtu.be/_wmXHgC706I) 37 | 38 | You can also check out these older video tutorials to learn more about Nanodash and how it can be used (the videos are from the time when Nanodash was still called Nanobench): 39 | 40 | - [Nanobench Tutorial 1: The Nanopublication Ecosystem](https://youtu.be/wPAd9wPkvEg) 41 | - (This second video is a bit outdated. You no longer need to install Nanobench/Nanodash locally, but you can use the link of the online instance above and skip this video.) 42 | [Nanobench Tutorial 2: Setting up Nanobench](https://youtu.be/GG21BhzxaQk) 43 | - [Nanobench Tutorial 3: Browsing and Publishing Nanopublications](https://youtu.be/-UB28HVEO38) 44 | - [Nanobench Tutorial 4: Creating Templates](https://youtu.be/gQk8ItHr38U) 45 | - [Nanobench Tutorial 5: Using the Query Services](https://youtu.be/U200GuqOBso) 46 | 47 | 48 | ### License 49 | 50 | Copyright (C) 2022-2024 Knowledge Pixels 51 | 52 | This program is free software: you can redistribute it and/or modify 53 | it under the terms of the GNU Affero General Public License as 54 | published by the Free Software Foundation, either version 3 of the 55 | License, or (at your option) any later version. 56 | 57 | This program is distributed in the hope that it will be useful, 58 | but WITHOUT ANY WARRANTY; without even the implied warranty of 59 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 60 | GNU Affero General Public License for more details. 61 | 62 | You should have received a copy of the GNU Affero General Public License 63 | along with this program. If not, see https://www.gnu.org/licenses/. 64 | -------------------------------------------------------------------------------- /docker-compose.override.yml.template: -------------------------------------------------------------------------------- 1 | services: 2 | nanodash: 3 | # volumes: 4 | # - ./local-data:/root/.nanopub # to store local data (config and user keys) in same directory 5 | environment: 6 | - CATALINA_OPTS=-Xms1G -Xmx6G 7 | - NANODASH_WEBSITE_URL=https://your.domain.org/ 8 | - NANODASH_ORCID_LOGIN_MODE=true 9 | - NANOPUB_ORCID_CLIENT_ID=your-orcid-client-id 10 | - NANOPUB_ORCID_CLIENT_SECRET=your-orcid-client-secret 11 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | nanodash: 3 | build: . 4 | image: nanopub/nanodash 5 | restart: unless-stopped 6 | ports: 7 | - 37373:8080 8 | volumes: 9 | - ~/.nanopub:/root/.nanopub 10 | - .:/local 11 | logging: 12 | options: 13 | max-size: "10m" 14 | max-file: "3" 15 | -------------------------------------------------------------------------------- /docker/launch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd "$(dirname "$0")" 4 | cd .. 5 | 6 | set -e 7 | 8 | docker-compose pull 9 | docker-compose up -d 10 | -------------------------------------------------------------------------------- /docker/update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd "$(dirname "$0")" 4 | cd .. 5 | 6 | set -e 7 | 8 | docker-compose down 9 | docker/launch.sh 10 | -------------------------------------------------------------------------------- /nanodash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knowledgepixels/nanodash/51abe37a090a05d7a22d82d53312f572ea82da5f/nanodash.png -------------------------------------------------------------------------------- /push-nanodash-test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | mvn clean package 6 | 7 | docker build -t nanopub/nanodash-test . 8 | docker push nanopub/nanodash-test 9 | -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | git pull 6 | 7 | THIS_VERSION=$(grep -oPm1 "(?<=)[^<]+" pom.xml) 8 | echo "Current version: $THIS_VERSION" 9 | 10 | if [[ "$THIS_VERSION" != *-SNAPSHOT ]]; then 11 | echo "ERROR: Not a snapshot version" 12 | exit 1 13 | fi 14 | 15 | NEW_VERSION=${THIS_VERSION%-SNAPSHOT} 16 | V_MAJOR=${NEW_VERSION%.*} 17 | V_MINOR=${NEW_VERSION#*.} 18 | NEXT_VERSION=$V_MAJOR.$(($V_MINOR+1))-SNAPSHOT 19 | 20 | echo "New version to be released: $NEW_VERSION" 21 | echo "Next version: $NEXT_VERSION" 22 | echo 23 | 24 | if [ -z $1 ] || [[ "$1" != "-" ]]; then 25 | echo "Perform release with:" 26 | echo "./release.sh -" 27 | exit 28 | fi 29 | 30 | git update-index --refresh -q || true 31 | git diff-index --quiet HEAD -- || LOCAL_CHANGES=1 32 | 33 | if [[ "$LOCAL_CHANGES" == 1 ]]; then 34 | echo "ERROR: Uncommitted local changes" 35 | exit 1 36 | fi 37 | 38 | echo "Change version to: $NEW_VERSION" 39 | mvn versions:set versions:commit -DnewVersion="$NEW_VERSION" 40 | git add pom.xml 41 | git commit -m "Version $NEW_VERSION" 42 | 43 | echo "Pushing new release..." 44 | git tag nanodash-$NEW_VERSION 45 | git push 46 | git push --tags 47 | 48 | echo "Make snapshot version: $NEXT_VERSION" 49 | mvn versions:set versions:commit -DnewVersion="$NEXT_VERSION" 50 | git add pom.xml 51 | git commit -m "Snapshot version $NEXT_VERSION" 52 | 53 | git push 54 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd "$( dirname "${BASH_SOURCE[0]}" )" 4 | 5 | docker compose down 6 | mvn package 7 | docker compose build 8 | docker compose up 9 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knowledgepixels/nanodash/51abe37a090a05d7a22d82d53312f572ea82da5f/screenshot.png -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/NanodashPageRef.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.apache.wicket.markup.html.WebMarkupContainer; 6 | import org.apache.wicket.markup.html.basic.Label; 7 | import org.apache.wicket.markup.html.link.BookmarkablePageLink; 8 | import org.apache.wicket.markup.html.link.ExternalLink; 9 | import org.apache.wicket.request.mapper.parameter.PageParameters; 10 | 11 | import com.knowledgepixels.nanodash.page.NanodashPage; 12 | 13 | public class NanodashPageRef implements Serializable { 14 | 15 | private static final long serialVersionUID = 1L; 16 | 17 | private final Class pageClass; 18 | private final PageParameters parameters; 19 | private final String label; 20 | 21 | public NanodashPageRef(Class pageClass, PageParameters parameters, String label) { 22 | this.pageClass = pageClass; 23 | this.parameters = parameters; 24 | this.label = label; 25 | } 26 | 27 | public NanodashPageRef(Class pageClass, String label) { 28 | this(pageClass, null, label); 29 | } 30 | 31 | public NanodashPageRef(String label) { 32 | this(null, null, label); 33 | } 34 | 35 | public Class getPageClass() { 36 | return pageClass; 37 | } 38 | 39 | public PageParameters getParameters() { 40 | return parameters; 41 | } 42 | 43 | public String getLabel() { 44 | return label; 45 | } 46 | 47 | public WebMarkupContainer createComponent(String id) { 48 | if (pageClass == null) { 49 | ExternalLink l = new ExternalLink(id, "#"); 50 | l.add(new Label(id + "-label", label)); 51 | return l; 52 | } else { 53 | BookmarkablePageLink l = new BookmarkablePageLink<>(id, pageClass, parameters); 54 | l.add(new Label(id + "-label", label)); 55 | return l; 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/RestrictedChoice.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash; 2 | 3 | import java.io.Serializable; 4 | import java.util.ArrayList; 5 | import java.util.Collections; 6 | import java.util.HashMap; 7 | import java.util.HashSet; 8 | import java.util.List; 9 | import java.util.Map; 10 | import java.util.Set; 11 | 12 | import org.apache.wicket.model.IModel; 13 | import org.eclipse.rdf4j.model.IRI; 14 | import org.eclipse.rdf4j.model.Value; 15 | import org.eclipse.rdf4j.model.ValueFactory; 16 | import org.eclipse.rdf4j.model.impl.SimpleValueFactory; 17 | 18 | import com.knowledgepixels.nanodash.template.TemplateContext; 19 | 20 | public class RestrictedChoice implements Serializable { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | private IRI placeholderIri; 25 | private TemplateContext context; 26 | private final Map fixedPossibleValues = new HashMap<>(); 27 | private final List possibleRefValues = new ArrayList<>(); 28 | 29 | public RestrictedChoice(IRI placeholderIri, TemplateContext context) { 30 | this.placeholderIri = placeholderIri; 31 | this.context = context; 32 | for (Value v : context.getTemplate().getPossibleValues(placeholderIri)) { 33 | if (v instanceof IRI && context.getTemplate().isPlaceholder((IRI) v)) { 34 | possibleRefValues.add((IRI) v); 35 | } else { 36 | fixedPossibleValues.put(v.toString(), true); 37 | } 38 | } 39 | } 40 | 41 | public List getPossibleValues() { 42 | Set possibleValues = new HashSet<>(); 43 | possibleValues.addAll(fixedPossibleValues.keySet()); 44 | for (IRI r : possibleRefValues) { 45 | for (int i = 0 ; true ; i++) { 46 | String suffix = "__" + i; 47 | if (i == 0) suffix = ""; 48 | IRI refIri = vf.createIRI(r.stringValue() + suffix); 49 | IModel m = context.getComponentModels().get(refIri); 50 | if (m == null) break; 51 | if (m.getObject() != null && !m.getObject().startsWith("\"")) { 52 | possibleValues.add(m.getObject()); 53 | } 54 | } 55 | } 56 | List possibleValuesList = new ArrayList<>(); 57 | for (String s : possibleValues) { 58 | if (context.getTemplate().isLocalResource(placeholderIri)) { 59 | if (s.matches("https?://.+")) continue; 60 | } 61 | possibleValuesList.add(s); 62 | } 63 | Collections.sort(possibleValuesList); 64 | return possibleValuesList; 65 | } 66 | 67 | public boolean hasPossibleRefValues() { 68 | return !possibleRefValues.isEmpty(); 69 | } 70 | 71 | public boolean hasFixedPossibleValue(String value) { 72 | return fixedPossibleValues.containsKey(value); 73 | } 74 | 75 | private static ValueFactory vf = SimpleValueFactory.getInstance(); 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/User.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import org.eclipse.rdf4j.model.IRI; 7 | import org.nanopub.Nanopub; 8 | import org.nanopub.extra.setting.IntroNanopub; 9 | 10 | public class User { 11 | 12 | private User() {} // no instances allowed 13 | 14 | private static transient UserData userData; 15 | 16 | public static void refreshUsers() { 17 | userData = new UserData(); 18 | } 19 | 20 | public synchronized static void ensureLoaded() { 21 | if (userData == null) refreshUsers(); 22 | } 23 | 24 | public static UserData getUserData() { 25 | ensureLoaded(); 26 | return userData; 27 | } 28 | 29 | public static boolean isApprovedKeyForUser(String key, IRI user) { 30 | return getUserData().isApprovedKeyForUser(key, user); 31 | } 32 | 33 | public static IRI getUserIri(String pubkey) { 34 | return getUserData().getUserIri(pubkey); 35 | } 36 | 37 | public static IRI getSignatureOwnerIri(Nanopub np) { 38 | return getUserData().getSignatureOwnerIri(np); 39 | } 40 | 41 | public static String getName(IRI userIri) { 42 | return getUserData().getName(userIri); 43 | } 44 | 45 | public static String getDisplayName(IRI userIri) { 46 | return getUserData().getDisplayName(userIri); 47 | } 48 | 49 | public static String getShortDisplayName(IRI userIri) { 50 | return getUserData().getShortDisplayName(userIri); 51 | } 52 | 53 | public static String getShortDisplayName(IRI userIri, String pubkey) { 54 | return getUserData().getShortDisplayName(userIri, pubkey); 55 | } 56 | 57 | public static IRI findSingleIdForPubkey(String pubkey) { 58 | return getUserData().findSingleIdForPubkey(pubkey); 59 | } 60 | 61 | public static List getUsers(boolean approved) { 62 | return getUserData().getUsers(approved); 63 | } 64 | 65 | public static List getPubkeys(IRI user, Boolean approved) { 66 | return getUserData().getPubkeys(user, approved); 67 | } 68 | 69 | public static List getIntroNanopubs(IRI user) { 70 | return getUserData().getIntroNanopubs( user); 71 | } 72 | 73 | public static Map getIntroNanopubs(String pubkey) { 74 | return getUserData().getIntroNanopubs(pubkey); 75 | } 76 | 77 | public static boolean isApproved(IntroNanopub in) { 78 | return getUserData().isApproved(in); 79 | } 80 | 81 | public static boolean isUser(IRI userIri) { 82 | return getUserData().isUser(userIri); 83 | } 84 | 85 | public static boolean isUser(String userId) { 86 | return getUserData().isUser(userId); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/action/ApprovalAction.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.action; 2 | 3 | import org.nanopub.Nanopub; 4 | 5 | public class ApprovalAction extends NanopubAction { 6 | 7 | private static final long serialVersionUID = 1789820405326599889L; 8 | 9 | public static final String TEMPLATE_URI = "http://purl.org/np/RAsmppaxXZ613z9olynInTqIo0oiCelsbONDi2c5jlEMg"; 10 | 11 | @Override 12 | public String getLinkLabel(Nanopub np) { 13 | return "approve/disapprove"; 14 | } 15 | 16 | @Override 17 | public String getTemplateUri(Nanopub np) { 18 | return TEMPLATE_URI; 19 | } 20 | 21 | @Override 22 | public String getParamString(Nanopub np) { 23 | return "param_nanopub=" + getEncodedUri(np); 24 | } 25 | 26 | @Override 27 | public boolean isApplicableToOwnNanopubs() { 28 | return false; 29 | } 30 | 31 | @Override 32 | public boolean isApplicableToOthersNanopubs() { 33 | return true; 34 | } 35 | 36 | @Override 37 | public boolean isApplicableTo(Nanopub np) { 38 | return true; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/action/CommentAction.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.action; 2 | 3 | import org.nanopub.Nanopub; 4 | 5 | public class CommentAction extends NanopubAction { 6 | 7 | private static final long serialVersionUID = 7995012295240119652L; 8 | 9 | public static final String TEMPLATE_URI = "http://purl.org/np/RAqfUmjV05ruLK3Efq2kCODsHfY16LJGO3nAwDi5rmtv0"; 10 | 11 | @Override 12 | public String getLinkLabel(Nanopub np) { 13 | return "comment"; 14 | } 15 | 16 | @Override 17 | public String getTemplateUri(Nanopub np) { 18 | return TEMPLATE_URI; 19 | } 20 | 21 | @Override 22 | public String getParamString(Nanopub np) { 23 | return "param_thing=" + getEncodedUri(np); 24 | } 25 | 26 | @Override 27 | public boolean isApplicableToOwnNanopubs() { 28 | return true; 29 | } 30 | 31 | @Override 32 | public boolean isApplicableToOthersNanopubs() { 33 | return true; 34 | } 35 | 36 | @Override 37 | public boolean isApplicableTo(Nanopub np) { 38 | return true; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/action/DeriveAction.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.action; 2 | 3 | import org.nanopub.Nanopub; 4 | 5 | import com.knowledgepixels.nanodash.template.TemplateData; 6 | 7 | public class DeriveAction extends NanopubAction { 8 | 9 | private static final long serialVersionUID = 4348436856820074305L; 10 | 11 | @Override 12 | public String getLinkLabel(Nanopub np) { 13 | return "edit as derived nanopublication"; 14 | } 15 | 16 | @Override 17 | public String getTemplateUri(Nanopub np) { 18 | if (TemplateData.get().getTemplateId(np) != null) { 19 | return TemplateData.get().getTemplateId(np).stringValue(); 20 | } else { 21 | return "http://purl.org/np/RACyK2NjqFgezYLiE8FQu7JI0xY1M1aNQbykeCW8oqXkA"; 22 | } 23 | } 24 | 25 | @Override 26 | public String getParamString(Nanopub np) { 27 | return "derive=" + getEncodedUri(np); 28 | } 29 | 30 | @Override 31 | public boolean isApplicableToOwnNanopubs() { 32 | return true; 33 | } 34 | 35 | @Override 36 | public boolean isApplicableToOthersNanopubs() { 37 | return true; 38 | } 39 | 40 | @Override 41 | public boolean isApplicableTo(Nanopub np) { 42 | return true; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/action/ImproveAction.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.action; 2 | 3 | import org.nanopub.Nanopub; 4 | 5 | import com.knowledgepixels.nanodash.template.TemplateData; 6 | 7 | public class ImproveAction extends NanopubAction { 8 | 9 | private static final long serialVersionUID = 7125118789143870705L; 10 | 11 | @Override 12 | public String getLinkLabel(Nanopub np) { 13 | return "improve"; 14 | } 15 | 16 | @Override 17 | public String getTemplateUri(Nanopub np) { 18 | return TemplateData.get().getTemplateId(np).stringValue(); 19 | } 20 | 21 | @Override 22 | public String getParamString(Nanopub np) { 23 | return "improve=" + getEncodedUri(np); 24 | } 25 | 26 | @Override 27 | public boolean isApplicableToOwnNanopubs() { 28 | return true; 29 | } 30 | 31 | @Override 32 | public boolean isApplicableToOthersNanopubs() { 33 | return true; 34 | } 35 | 36 | @Override 37 | public boolean isApplicableTo(Nanopub np) { 38 | return TemplateData.get().getTemplateId(np) != null; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/action/NanopubAction.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.action; 2 | 3 | import java.io.Serializable; 4 | import java.util.ArrayList; 5 | import java.util.HashMap; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import org.nanopub.Nanopub; 10 | 11 | import com.knowledgepixels.nanodash.NanodashPreferences; 12 | import com.knowledgepixels.nanodash.Utils; 13 | 14 | public abstract class NanopubAction implements Serializable { 15 | 16 | private static final long serialVersionUID = 4086842804225420496L; 17 | 18 | public static final NanopubAction[] noActions = new NanopubAction[0]; 19 | 20 | public static final NanopubAction[] defaultActions; 21 | 22 | public static final NanopubAction[] ownActions; 23 | 24 | private static Map defaultClassNameMap = new HashMap<>(); 25 | 26 | static { 27 | List da = new ArrayList<>(); 28 | da.add(new CommentAction()); 29 | da.add(new RetractionAction()); 30 | da.add(new ApprovalAction()); 31 | da.add(new UpdateAction()); 32 | da.add(new DeriveAction()); 33 | da.add(new UseSameTemplateAction()); 34 | da.add(new UseTemplateAction()); 35 | defaultActions = da.toArray(new NanopubAction[0]); 36 | 37 | List oa = new ArrayList<>(); 38 | oa.add(new RetractionAction()); 39 | oa.add(new UpdateAction()); 40 | ownActions = oa.toArray(new NanopubAction[0]); 41 | 42 | for (NanopubAction na : defaultActions) { 43 | defaultClassNameMap.put(na.getClass().getCanonicalName(), na); 44 | } 45 | } 46 | 47 | public static List getActionsFromPreferences(NanodashPreferences pref) { 48 | List actions = new ArrayList<>(); 49 | if (pref == null) return actions; 50 | for (String s : pref.getNanopubActions()) { 51 | if (defaultClassNameMap.containsKey(s)) continue; 52 | try { 53 | NanopubAction na = (NanopubAction) Class.forName(s).getDeclaredConstructor().newInstance(); 54 | actions.add(na); 55 | } catch (Exception ex) { 56 | ex.printStackTrace(); 57 | } 58 | } 59 | return actions; 60 | } 61 | 62 | public abstract String getLinkLabel(Nanopub np); 63 | 64 | public abstract String getTemplateUri(Nanopub np); 65 | 66 | public abstract String getParamString(Nanopub np); 67 | 68 | public abstract boolean isApplicableToOwnNanopubs(); 69 | 70 | public abstract boolean isApplicableToOthersNanopubs(); 71 | 72 | public abstract boolean isApplicableTo(Nanopub np); 73 | 74 | protected static String getEncodedUri(Nanopub np) { 75 | return Utils.urlEncode(np.getUri().stringValue()); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/action/RetractionAction.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.action; 2 | 3 | import org.nanopub.Nanopub; 4 | 5 | public class RetractionAction extends NanopubAction { 6 | 7 | private static final long serialVersionUID = 7802391790148929067L; 8 | 9 | public static final String TEMPLATE_URI = "http://purl.org/np/RAvySE8-JDPqaPnm_XShAa-aVuDZ2iW2z7Oc1Q9cfvxZE"; 10 | 11 | @Override 12 | public String getLinkLabel(Nanopub np) { 13 | return "retract"; 14 | } 15 | 16 | @Override 17 | public String getTemplateUri(Nanopub np) { 18 | return TEMPLATE_URI; 19 | } 20 | 21 | @Override 22 | public String getParamString(Nanopub np) { 23 | return "param_nanopubToBeRetracted=" + getEncodedUri(np); 24 | } 25 | 26 | @Override 27 | public boolean isApplicableToOwnNanopubs() { 28 | return true; 29 | } 30 | 31 | @Override 32 | public boolean isApplicableToOthersNanopubs() { 33 | return false; 34 | } 35 | 36 | @Override 37 | public boolean isApplicableTo(Nanopub np) { 38 | return true; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/action/UpdateAction.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.action; 2 | 3 | import org.nanopub.Nanopub; 4 | 5 | import com.knowledgepixels.nanodash.template.TemplateData; 6 | 7 | public class UpdateAction extends NanopubAction { 8 | 9 | private static final long serialVersionUID = -7703679333911796987L; 10 | 11 | @Override 12 | public String getLinkLabel(Nanopub np) { 13 | return "update"; 14 | } 15 | 16 | @Override 17 | public String getTemplateUri(Nanopub np) { 18 | if (TemplateData.get().getTemplateId(np) != null) { 19 | return TemplateData.get().getTemplateId(np).stringValue(); 20 | } else { 21 | return "http://purl.org/np/RACyK2NjqFgezYLiE8FQu7JI0xY1M1aNQbykeCW8oqXkA"; 22 | } 23 | } 24 | 25 | @Override 26 | public String getParamString(Nanopub np) { 27 | return "supersede=" + getEncodedUri(np); 28 | } 29 | 30 | @Override 31 | public boolean isApplicableToOwnNanopubs() { 32 | return true; 33 | } 34 | 35 | @Override 36 | public boolean isApplicableToOthersNanopubs() { 37 | return false; 38 | } 39 | 40 | @Override 41 | public boolean isApplicableTo(Nanopub np) { 42 | return true; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/action/UseSameTemplateAction.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.action; 2 | 3 | import org.nanopub.Nanopub; 4 | 5 | import com.knowledgepixels.nanodash.template.TemplateData; 6 | 7 | public class UseSameTemplateAction extends NanopubAction { 8 | 9 | private static final long serialVersionUID = 4348436856820074305L; 10 | 11 | @Override 12 | public String getLinkLabel(Nanopub np) { 13 | return "create new with same template"; 14 | } 15 | 16 | @Override 17 | public String getTemplateUri(Nanopub np) { 18 | return TemplateData.get().getTemplateId(np).stringValue(); 19 | } 20 | 21 | @Override 22 | public String getParamString(Nanopub np) { 23 | return ""; 24 | } 25 | 26 | @Override 27 | public boolean isApplicableToOwnNanopubs() { 28 | return true; 29 | } 30 | 31 | @Override 32 | public boolean isApplicableToOthersNanopubs() { 33 | return true; 34 | } 35 | 36 | @Override 37 | public boolean isApplicableTo(Nanopub np) { 38 | return TemplateData.get().getTemplateId(np) != null; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/action/UseTemplateAction.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.action; 2 | 3 | import org.nanopub.Nanopub; 4 | 5 | import com.knowledgepixels.nanodash.Utils; 6 | import com.knowledgepixels.nanodash.template.Template; 7 | 8 | public class UseTemplateAction extends NanopubAction { 9 | 10 | private static final long serialVersionUID = 4348436856820074305L; 11 | 12 | @Override 13 | public String getLinkLabel(Nanopub np) { 14 | return "use template"; 15 | } 16 | 17 | @Override 18 | public String getTemplateUri(Nanopub np) { 19 | return np.getUri().stringValue(); 20 | } 21 | 22 | @Override 23 | public String getParamString(Nanopub np) { 24 | return ""; 25 | } 26 | 27 | @Override 28 | public boolean isApplicableToOwnNanopubs() { 29 | return true; 30 | } 31 | 32 | @Override 33 | public boolean isApplicableToOthersNanopubs() { 34 | return true; 35 | } 36 | 37 | @Override 38 | public boolean isApplicableTo(Nanopub np) { 39 | return Utils.isNanopubOfClass(np, Template.ASSERTION_TEMPLATE_CLASS); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ActionMenu.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Item 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ActionMenu.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import static java.nio.charset.StandardCharsets.UTF_8; 4 | 5 | import java.net.URLEncoder; 6 | import java.util.List; 7 | 8 | import org.apache.wicket.markup.html.link.ExternalLink; 9 | import org.apache.wicket.markup.html.panel.Panel; 10 | import org.apache.wicket.markup.repeater.Item; 11 | import org.apache.wicket.markup.repeater.data.DataView; 12 | import org.apache.wicket.markup.repeater.data.ListDataProvider; 13 | import org.eclipse.rdf4j.model.IRI; 14 | 15 | import com.knowledgepixels.nanodash.NanodashSession; 16 | import com.knowledgepixels.nanodash.NanopubElement; 17 | import com.knowledgepixels.nanodash.User; 18 | import com.knowledgepixels.nanodash.UserData; 19 | import com.knowledgepixels.nanodash.Utils; 20 | import com.knowledgepixels.nanodash.action.NanopubAction; 21 | import com.knowledgepixels.nanodash.page.PublishPage; 22 | 23 | public class ActionMenu extends Panel { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | public ActionMenu(String id, final List menuItems, final NanopubElement n) { 28 | super(id); 29 | 30 | final NanodashSession session = NanodashSession.get(); 31 | final UserData userData = User.getUserData(); 32 | final IRI userIri = session.getUserIri(); 33 | 34 | add(new DataView("menulist", new ListDataProvider(menuItems)) { 35 | 36 | private static final long serialVersionUID = 1L; 37 | 38 | @Override 39 | protected void populateItem(Item item) { 40 | NanopubAction action = item.getModel().getObject(); 41 | String location = ""; 42 | String extraLabel = ""; 43 | final String pubkey = n.getPubkey(); 44 | String sigkeyParam = ""; 45 | if (action.isApplicableToOwnNanopubs() && !action.isApplicableToOthersNanopubs()) { 46 | if (userIri != null && pubkey != null && !session.getPubkeyString().equals(pubkey)) { 47 | IRI keyLocation = userData.getKeyLocation(pubkey); 48 | if (keyLocation == null) { 49 | location = "http://localhost:37373"; 50 | extraLabel = " at localhost"; 51 | } else { 52 | location = keyLocation.stringValue().replaceFirst("/$", ""); 53 | extraLabel = " at " + Utils.getPubkeyLocationName(pubkey, "localhost"); 54 | } 55 | sigkeyParam = "&sigkey=" + URLEncoder.encode(pubkey, UTF_8); 56 | } 57 | } 58 | String url = location + PublishPage.MOUNT_PATH + "?template=" + Utils.urlEncode(action.getTemplateUri(n.getNanopub())) + 59 | "&" + action.getParamString(n.getNanopub()) + 60 | "&template-version=latest" + sigkeyParam; 61 | item.add(new ExternalLink("menuitem", url, action.getLinkLabel(n.getNanopub()) + extraLabel)); 62 | } 63 | 64 | }); 65 | 66 | setVisible(!menuItems.isEmpty()); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ActivityPanel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
type24-0924-10
TypeXYZ013
TypeABC5142
15 |
16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/AgentChoiceItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ComponentSequence.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | , component 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ComponentSequence.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.wicket.Component; 6 | import org.apache.wicket.markup.html.basic.Label; 7 | import org.apache.wicket.markup.html.list.ListItem; 8 | import org.apache.wicket.markup.html.list.ListView; 9 | import org.apache.wicket.markup.html.panel.Panel; 10 | 11 | public class ComponentSequence extends Panel { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public ComponentSequence(String id, final String separator, final List components) { 16 | super(id); 17 | add(new ListView("components", components) { 18 | 19 | private static final long serialVersionUID = 1L; 20 | private boolean isFirst = true; 21 | 22 | @Override 23 | protected void populateItem(ListItem item) { 24 | if (isFirst) { 25 | item.add(new Label("separator").setVisible(false)); 26 | isFirst = false; 27 | } else { 28 | item.add(new Label("separator", separator)); 29 | } 30 | item.add(item.getModelObject()); 31 | } 32 | 33 | }); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ContextComponent.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import org.eclipse.rdf4j.model.Value; 4 | 5 | import com.knowledgepixels.nanodash.template.UnificationException; 6 | 7 | public interface ContextComponent { 8 | 9 | public void removeFromContext(); 10 | 11 | public boolean isUnifiableWith(Value v); 12 | 13 | public void unifyWith(Value v) throws UnificationException; 14 | 15 | public void fillFinished(); 16 | 17 | public void finalizeValues(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/DifferentKeyErrorItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

12 | This link for publishing nanopublications doesn't work. 13 | It assumes the local key for signatures to be . 14 | Your local key on this site, however, is . 15 |

16 | 17 |
18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/DifferentKeyErrorItem.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import org.apache.wicket.markup.html.basic.Label; 4 | import org.apache.wicket.markup.html.panel.Panel; 5 | import org.apache.wicket.request.mapper.parameter.PageParameters; 6 | 7 | import com.knowledgepixels.nanodash.NanodashSession; 8 | import com.knowledgepixels.nanodash.Utils; 9 | 10 | public class DifferentKeyErrorItem extends Panel { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | public DifferentKeyErrorItem(String id, final PageParameters parameters) { 15 | super(id); 16 | final NanodashSession session = NanodashSession.get(); 17 | add(new Label("linkkey", Utils.getShortPubkeyName(parameters.get("sigkey").toString()))); 18 | add(new Label("localkey", Utils.getShortPubkeyName(session.getPubkeyString()))); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ExploreDataTable.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

12 | 13 |
14 | 15 |

Show All

16 | 17 |
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/GuidedChoiceItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/LiteralItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | "" 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/LiteralItem.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import org.apache.wicket.markup.html.basic.Label; 4 | import org.apache.wicket.markup.html.panel.Panel; 5 | import org.eclipse.rdf4j.model.Literal; 6 | import org.eclipse.rdf4j.model.Value; 7 | 8 | import com.knowledgepixels.nanodash.component.StatementItem.RepetitionGroup; 9 | import com.knowledgepixels.nanodash.template.UnificationException; 10 | 11 | public class LiteralItem extends Panel implements ContextComponent { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | private Literal literal; 16 | // private PublishFormContext context; 17 | 18 | public LiteralItem(String id, String parentId, Literal literal, RepetitionGroup rg) { 19 | super(id); 20 | this.literal = literal; 21 | // this.context = rg.getContext(); 22 | add(new Label("literal", literal.stringValue())); 23 | } 24 | 25 | @Override 26 | public void removeFromContext() { 27 | // Nothing to be done here. 28 | } 29 | 30 | @Override 31 | public boolean isUnifiableWith(Value v) { 32 | if (!(v instanceof Literal)) return false; 33 | return literal.stringValue().equals(v.stringValue()); 34 | } 35 | 36 | @Override 37 | public void unifyWith(Value v) throws UnificationException { 38 | if (!isUnifiableWith(v)) throw new UnificationException(v.stringValue()); 39 | // Nothing left to be done here. 40 | } 41 | 42 | @Override 43 | public void fillFinished() { 44 | } 45 | 46 | @Override 47 | public void finalizeValues() { 48 | } 49 | 50 | public String toString() { 51 | return "[Literal item: " + literal.stringValue() + "]"; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/LiteralTextareaItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | "" 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/LiteralTextareaItem.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import org.apache.wicket.markup.html.form.AbstractTextComponent; 4 | import org.apache.wicket.markup.html.form.TextArea; 5 | import org.apache.wicket.model.IModel; 6 | import org.eclipse.rdf4j.model.IRI; 7 | 8 | import com.knowledgepixels.nanodash.template.TemplateContext; 9 | 10 | public class LiteralTextareaItem extends LiteralTextfieldItem { 11 | 12 | private static final long serialVersionUID = 1L; 13 | private TextArea textarea; 14 | 15 | public LiteralTextareaItem(String id, final IRI iri, boolean optional, TemplateContext context) { 16 | super(id, iri, optional, context); 17 | } 18 | protected AbstractTextComponent initTextComponent(IModel model) { 19 | textarea = new TextArea<>("textarea", model); 20 | return textarea; 21 | } 22 | 23 | protected AbstractTextComponent getTextComponent() { 24 | return textarea; 25 | } 26 | 27 | public String toString() { 28 | return "[Long literal textfield item]"; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/LiteralTextfieldItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | "" 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/NanodashLink.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | description 12 | http://example.org/foo 13 | 14 | link 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/NanopubItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

14 |  link-ID 15 | type 16 | 17 |

18 | 19 |
20 | 21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | 34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | 45 |
46 | 47 |
48 | 49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | 57 |
58 |
59 |
60 | 61 |
62 | 63 |
64 | 65 | 72 |
73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/NanopubResults.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 |
15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/NanopubResults.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import java.util.List; 4 | 5 | import org.apache.wicket.markup.html.panel.Panel; 6 | import org.apache.wicket.markup.repeater.Item; 7 | import org.apache.wicket.markup.repeater.data.DataView; 8 | import org.apache.wicket.markup.repeater.data.ListDataProvider; 9 | import org.nanopub.extra.services.ApiResponse; 10 | import org.nanopub.extra.services.ApiResponseEntry; 11 | 12 | import com.knowledgepixels.nanodash.NanopubElement; 13 | import com.knowledgepixels.nanodash.Utils; 14 | 15 | public class NanopubResults extends Panel { 16 | 17 | private static final long serialVersionUID = -5109507637942030910L; 18 | 19 | public static NanopubResults fromList(String id, List nanopubList) { 20 | NanopubResults r = new NanopubResults(id); 21 | r.add(new DataView("nanopubs", new ListDataProvider(nanopubList)) { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | @Override 26 | protected void populateItem(Item item) { 27 | item.add(new NanopubItem("nanopub", item.getModelObject()).setMinimal()); 28 | } 29 | 30 | }); 31 | return r; 32 | } 33 | 34 | public static NanopubResults fromApiResponse(String id, ApiResponse apiResponse) { 35 | return fromApiResponse(id, apiResponse, -1); 36 | } 37 | 38 | public static NanopubResults fromApiResponse(String id, ApiResponse apiResponse, int limit) { 39 | List list = apiResponse.getData(); 40 | if (limit >= 0 && list.size() > limit) { 41 | list = Utils.subList(list, 0, limit); 42 | } 43 | NanopubResults r = new NanopubResults(id); 44 | r.add(new DataView("nanopubs", new ListDataProvider(list)) { 45 | 46 | private static final long serialVersionUID = 1L; 47 | 48 | @Override 49 | protected void populateItem(Item item) { 50 | item.add(new NanopubItem("nanopub", NanopubElement.get(item.getModelObject().get("np"))).setMinimal()); 51 | } 52 | 53 | }); 54 | return r; 55 | } 56 | 57 | private NanopubResults(String id) { 58 | super(id); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ProfileIntroItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Introductions

12 | 13 |

Introductions link your ORCID identifier to the keys you use to sign nanopublications.

14 | 15 |

After changes, you may have to wait a few minutes and refresh this page for this list to update:

16 | 17 |
    18 |
  • 19 | 20 | created on 21 | at 22 | declares keys: 23 |   24 | 25 | 26 | 27 | 28 | 31 | 32 |
  • 33 |
34 | 35 |

36 | 37 |

Recommended Actions

38 | 39 |

40 | 41 |
    42 |
  • If you recognize an introduction above as your own, use 'derive new introduction' to declare the given keys 43 | alongside the local key from this site.
  • 44 |
  • If you recognize an introduction from another site as your own, use 'include keys' above to declare the missing 45 | keys also in the introduction from this site.
  • 46 |
  • Publish an introduction from scratch declaring your local key:
  • 47 |
  • Retract redundant introductions created on this site, using 'retract' above
  • 48 |
  • Go to the site where you created your approved introduction (see above) and include the local key from this site there 49 | (it should show up there in a list similar to the above).
  • 50 |
  • Contact somebody you know who is approved and ask them to approve of your introduction 51 | (via 'approve somebody else' on their user list page). Give them this URL of your introduction nanopublication: 52 |
  • 53 |
  • Follow these guidelines to link your introduction from your ORCID account.
  • 54 |
55 | 56 |
57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ProfileItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | profile text 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ProfileItem.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import org.apache.wicket.markup.html.basic.Label; 4 | import org.apache.wicket.markup.html.link.BookmarkablePageLink; 5 | import org.apache.wicket.markup.html.link.ExternalLink; 6 | import org.apache.wicket.markup.html.panel.Panel; 7 | import org.apache.wicket.request.mapper.parameter.PageParameters; 8 | import org.eclipse.rdf4j.model.IRI; 9 | 10 | import com.knowledgepixels.nanodash.NanodashPreferences; 11 | import com.knowledgepixels.nanodash.NanodashSession; 12 | import com.knowledgepixels.nanodash.User; 13 | import com.knowledgepixels.nanodash.page.HomePage; 14 | import com.knowledgepixels.nanodash.page.NanodashPage; 15 | import com.knowledgepixels.nanodash.page.OrcidLoginPage; 16 | import com.knowledgepixels.nanodash.page.ProfilePage; 17 | import com.knowledgepixels.nanodash.page.UserPage; 18 | 19 | public class ProfileItem extends Panel { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public ProfileItem(String id, NanodashPage page) { 24 | super(id); 25 | NanodashSession session = NanodashSession.get(); 26 | NanodashPreferences prefs = NanodashPreferences.get(); 27 | IRI userId = session.getUserIri(); 28 | if (prefs.isOrcidLoginMode() && userId == null) { 29 | String redirectMountPath = ProfilePage.MOUNT_PATH; 30 | PageParameters redirectPageParams = new PageParameters(); 31 | if (page != null) { 32 | redirectMountPath = ((NanodashPage) page).getMountPath(); 33 | redirectPageParams = ((NanodashPage) page).getPageParameters(); 34 | } 35 | ExternalLink l = new ExternalLink("profilelink", OrcidLoginPage.getOrcidLoginUrl(redirectMountPath, redirectPageParams)); 36 | l.add(new Label("profiletext", "Login with ORCID")); 37 | add(l); 38 | } else if (prefs.isReadOnlyMode()) { 39 | BookmarkablePageLink l = new BookmarkablePageLink<>("profilelink", HomePage.class); 40 | l.add(new Label("profiletext", "")); 41 | add(l); 42 | } else { 43 | if (userId != null) { 44 | BookmarkablePageLink l = new BookmarkablePageLink("profilelink", UserPage.class, new PageParameters().add("id", userId.stringValue())); 45 | l.add(new Label("profiletext", User.getShortDisplayName(userId))); 46 | add(l); 47 | } else { 48 | BookmarkablePageLink l = new BookmarkablePageLink("profilelink", ProfilePage.class); 49 | l.add(new Label("profiletext", "incomplete profile")); 50 | add(l); 51 | } 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ProfileSigItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Key for Signatures

12 | 13 |

14 | 15 |

Local key file:

16 | 17 |
18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ProfileSigItem.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import org.apache.wicket.markup.html.WebMarkupContainer; 4 | import org.apache.wicket.markup.html.basic.Label; 5 | import org.apache.wicket.markup.html.panel.Panel; 6 | 7 | import com.knowledgepixels.nanodash.NanodashPreferences; 8 | import com.knowledgepixels.nanodash.NanodashSession; 9 | 10 | public class ProfileSigItem extends Panel { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | public ProfileSigItem(String id) { 15 | super(id); 16 | boolean loginMode = NanodashPreferences.get().isOrcidLoginMode(); 17 | 18 | final NanodashSession session = NanodashSession.get(); 19 | 20 | WebMarkupContainer localFilePanel = new WebMarkupContainer("localfile"); 21 | if (loginMode) { 22 | localFilePanel.add(new Label("keyfile", "")); 23 | localFilePanel.setVisible(false); 24 | } else { 25 | localFilePanel.add(new Label("keyfile", session.getKeyFile().getPath())); 26 | } 27 | add(localFilePanel); 28 | if (session.getKeyFile().exists()) { 29 | if (session.getKeyPair() == null) { 30 | add(new Label("pubkey", "Error loading key file")); 31 | } else { 32 | add(new PubkeyItem("pubkey", session.getPubkeyString())); 33 | } 34 | } else { 35 | add(new Label("pubkey", "")); 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ProjectList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ProjectList.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import org.apache.wicket.markup.html.basic.Label; 4 | import org.apache.wicket.markup.html.link.BookmarkablePageLink; 5 | import org.apache.wicket.markup.html.panel.Panel; 6 | import org.apache.wicket.markup.repeater.Item; 7 | import org.apache.wicket.markup.repeater.data.DataView; 8 | import org.apache.wicket.markup.repeater.data.ListDataProvider; 9 | import org.apache.wicket.request.mapper.parameter.PageParameters; 10 | import org.nanopub.extra.services.ApiResponse; 11 | import org.nanopub.extra.services.ApiResponseEntry; 12 | 13 | import com.knowledgepixels.nanodash.page.ProjectPage; 14 | 15 | public class ProjectList extends Panel { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | public ProjectList(String id, ApiResponse resp) { 20 | super(id); 21 | add(new DataView("projectlist", new ListDataProvider(resp.getData())) { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | @Override 26 | protected void populateItem(Item item) { 27 | ApiResponseEntry e = item.getModelObject(); 28 | PageParameters params = new PageParameters(); 29 | params.add("id", e.get("project")); 30 | BookmarkablePageLink l = new BookmarkablePageLink("projectlink", ProjectPage.class, params); 31 | l.add(new Label("linktext", e.get("label"))); 32 | item.add(l); 33 | } 34 | 35 | }); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/PubkeyItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

12 | 13 | is the local key that is used to sign your nanopublications on this site. 14 | 15 |

16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/PubkeyItem.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import org.apache.wicket.markup.html.basic.Label; 4 | import org.apache.wicket.markup.html.panel.Panel; 5 | 6 | import com.knowledgepixels.nanodash.NanodashSession; 7 | import com.knowledgepixels.nanodash.Utils; 8 | 9 | public class PubkeyItem extends Panel { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | public PubkeyItem(String id, String pubkey) { 14 | super(id); 15 | 16 | NanodashSession session = NanodashSession.get(); 17 | if (pubkey == null || pubkey.isEmpty()) { 18 | add(new Label("label", "..")); 19 | add(new Label("notes", "")); 20 | //add(new Label("fullkey", "(key does not exist)")); 21 | } else { 22 | add(new Label("label", Utils.getShortPubkeyName(pubkey))); 23 | String notes = ""; 24 | if (session.isPubkeyApproved()) { 25 | notes += "It is approved by the community."; 26 | } else { 27 | notes += "It is so far not approved by the community."; 28 | } 29 | add(new Label("notes", notes).setEscapeModelStrings(false)); 30 | //add(new Label("fullkey", pubkey)); 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/QueryList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
    12 |
  • query - by user, timestamp
  • 13 |
14 | 15 |
16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/QueryList.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.ArrayList; 5 | import java.util.Calendar; 6 | import java.util.List; 7 | 8 | import org.apache.wicket.markup.html.basic.Label; 9 | import org.apache.wicket.markup.html.link.BookmarkablePageLink; 10 | import org.apache.wicket.markup.html.panel.Panel; 11 | import org.apache.wicket.markup.repeater.Item; 12 | import org.apache.wicket.markup.repeater.data.DataView; 13 | import org.apache.wicket.markup.repeater.data.ListDataProvider; 14 | import org.apache.wicket.request.mapper.parameter.PageParameters; 15 | import org.eclipse.rdf4j.model.IRI; 16 | import org.nanopub.SimpleTimestampPattern; 17 | import org.nanopub.extra.security.NanopubSignatureElement; 18 | import org.nanopub.extra.security.SignatureUtils; 19 | import org.nanopub.extra.services.ApiResponse; 20 | import org.nanopub.extra.services.ApiResponseEntry; 21 | 22 | import com.knowledgepixels.nanodash.GrlcQuery; 23 | import com.knowledgepixels.nanodash.User; 24 | import com.knowledgepixels.nanodash.page.QueryPage; 25 | 26 | public class QueryList extends Panel { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | public QueryList(String id, ApiResponse resp) { 31 | super(id); 32 | List queries = new ArrayList<>(); 33 | for (ApiResponseEntry e : resp.getData()) { 34 | try { 35 | queries.add(new GrlcQuery(e.get("np"))); 36 | } catch (Exception ex) { 37 | ex.printStackTrace(); 38 | } 39 | } 40 | 41 | add(new DataView("querylist", new ListDataProvider(queries)) { 42 | 43 | private static final long serialVersionUID = 1L; 44 | 45 | @Override 46 | protected void populateItem(Item item) { 47 | GrlcQuery q = item.getModelObject(); 48 | PageParameters params = new PageParameters(); 49 | params.add("id", q.getQueryId()); 50 | BookmarkablePageLink l = new BookmarkablePageLink("querylink", QueryPage.class, params); 51 | l.add(new Label("linktext", q.getLabel())); 52 | item.add(l); 53 | 54 | String userString = "somebody"; 55 | try { 56 | NanopubSignatureElement se = SignatureUtils.getSignatureElement(q.getNanopub()); 57 | if (se != null) { 58 | IRI signer = (se.getSigners().isEmpty() ? null : se.getSigners().iterator().next()); 59 | userString = User.getShortDisplayName(signer, se.getPublicKeyString()); 60 | } 61 | } catch (Exception ex) { 62 | ex.printStackTrace(); 63 | } 64 | item.add(new Label("user", userString)); 65 | String timeString = "unknown date"; 66 | Calendar c = SimpleTimestampPattern.getCreationTime(q.getNanopub()); 67 | if (c != null) { 68 | timeString = (new SimpleDateFormat("yyyy-MM-dd")).format(c.getTime()); 69 | } 70 | item.add(new Label("timestamp", timeString)); 71 | } 72 | 73 | }); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/QueryParamField.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Param name: 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/QueryParamField.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import java.net.URISyntaxException; 4 | 5 | import org.apache.wicket.markup.html.basic.Label; 6 | import org.apache.wicket.markup.html.form.TextField; 7 | import org.apache.wicket.markup.html.panel.Panel; 8 | import org.apache.wicket.model.IModel; 9 | import org.apache.wicket.model.Model; 10 | import org.apache.wicket.validation.INullAcceptingValidator; 11 | import org.apache.wicket.validation.IValidatable; 12 | import org.apache.wicket.validation.ValidationError; 13 | import org.eclipse.rdf4j.common.net.ParsedIRI; 14 | 15 | public class QueryParamField extends Panel { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | private final TextField textfield; 20 | private final String paramId; 21 | 22 | public QueryParamField(String id, String paramId) { 23 | super(id); 24 | this.paramId = paramId; 25 | add(new Label("paramname", getParamName())); 26 | textfield = new TextField<>("textfield", Model.of("")); 27 | textfield.add(new Validator()); 28 | add(textfield); 29 | add(new Label("marker", isOptional() ? "" : "*")); 30 | } 31 | 32 | public TextField getTextField() { 33 | return textfield; 34 | } 35 | 36 | public String getValue() { 37 | return textfield.getModelObject(); 38 | } 39 | 40 | public String getParamId() { 41 | return paramId; 42 | } 43 | 44 | public String getParamName() { 45 | return paramId.replaceFirst("^_+", "").replaceFirst("_iri$", ""); 46 | } 47 | 48 | public IModel getModel() { 49 | return textfield.getModel(); 50 | } 51 | 52 | public boolean isOptional() { 53 | return paramId.startsWith("__"); 54 | } 55 | 56 | public boolean isIri() { 57 | return paramId.endsWith("_iri"); 58 | } 59 | 60 | 61 | private class Validator extends InvalidityHighlighting implements INullAcceptingValidator { 62 | 63 | private static final long serialVersionUID = 1L; 64 | 65 | @Override 66 | public void validate(IValidatable s) { 67 | String value = s.getValue(); 68 | if (isOptional() && !isSet(value)) { 69 | // all good 70 | return; 71 | } 72 | if (!isSet(value)) { 73 | s.error(new ValidationError("Missing value for " + paramId)); 74 | return; 75 | } 76 | if (isIri()) { 77 | if (!value.matches("https?://.+")) { 78 | s.error(new ValidationError("Invalid IRI protocol: " + value)); 79 | return; 80 | } 81 | try { 82 | ParsedIRI piri = new ParsedIRI(value); 83 | if (!piri.isAbsolute()) { 84 | s.error(new ValidationError("IRI not well-formed: " + value)); 85 | } 86 | } catch (URISyntaxException ex) { 87 | s.error(new ValidationError("IRI not well-formed: " + value)); 88 | } 89 | } 90 | } 91 | 92 | private static boolean isSet(String s) { 93 | return s != null && !s.isBlank(); 94 | } 95 | 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/QueryResultTable.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Query

12 | 13 |

details

14 | 15 |
16 | 17 |
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ReactionList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
    12 |
  • 13 |
14 | 15 |

(no reactions yet)

16 | 17 |
18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ReactionList.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import org.apache.wicket.markup.html.basic.Label; 4 | import org.apache.wicket.markup.html.link.BookmarkablePageLink; 5 | import org.apache.wicket.markup.html.panel.Panel; 6 | import org.apache.wicket.markup.repeater.Item; 7 | import org.apache.wicket.markup.repeater.data.DataView; 8 | import org.apache.wicket.markup.repeater.data.ListDataProvider; 9 | import org.apache.wicket.request.mapper.parameter.PageParameters; 10 | import org.nanopub.Nanopub; 11 | import org.nanopub.extra.services.ApiResponse; 12 | import org.nanopub.extra.services.ApiResponseEntry; 13 | 14 | import com.knowledgepixels.nanodash.User; 15 | import com.knowledgepixels.nanodash.page.ExplorePage; 16 | 17 | public class ReactionList extends Panel { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | public ReactionList(String id, ApiResponse resp, Nanopub np) { 22 | super(id); 23 | 24 | add(new DataView("reactions", new ListDataProvider(resp.getData())) { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | @Override 29 | protected void populateItem(Item item) { 30 | ApiResponseEntry e = item.getModelObject(); 31 | PageParameters params = new PageParameters(); 32 | if (e.get("pub").equals(np.getUri().stringValue())) { 33 | item.add(new Label("reactionnote")); 34 | } else { 35 | item.add(new Label("reactionnote", "On earlier version:")); 36 | } 37 | item.add(new Label("reactiontext", "\"" + e.get("text") + "\" (" + e.get("reltext") + " the nanopublication above)")); 38 | params.add("id", e.get("np")); 39 | BookmarkablePageLink l = new BookmarkablePageLink("reactionlink", ExplorePage.class, params); 40 | String username = User.getShortDisplayName(null, e.get("pubkey")); 41 | l.add(new Label("reactionlinktext", "by " + username + " on " + e.get("date").substring(0, 10))); 42 | item.add(l); 43 | } 44 | 45 | }); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/ReadonlyItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | HTML content... 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/RestrictedChoiceItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/SequenceElementItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/SequenceElementItem.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import org.apache.wicket.markup.html.basic.Label; 4 | import org.apache.wicket.markup.html.link.ExternalLink; 5 | import org.apache.wicket.markup.html.panel.Panel; 6 | import org.apache.wicket.model.Model; 7 | import org.eclipse.rdf4j.model.IRI; 8 | import org.eclipse.rdf4j.model.Literal; 9 | import org.eclipse.rdf4j.model.Value; 10 | 11 | import com.knowledgepixels.nanodash.Utils; 12 | import com.knowledgepixels.nanodash.template.TemplateContext; 13 | import com.knowledgepixels.nanodash.template.UnificationException; 14 | 15 | public class SequenceElementItem extends Panel implements ContextComponent { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | public static final String SEQUENCE_ELEMENT_PROPERTY_PREFIX = "http://www.w3.org/1999/02/22-rdf-syntax-ns#_"; 20 | 21 | private final int number; 22 | 23 | public SequenceElementItem(String id, final IRI iri, int number, TemplateContext context) { 24 | super(id); 25 | this.number = number; 26 | context.getComponentModels().put(iri, Model.of(SEQUENCE_ELEMENT_PROPERTY_PREFIX + number)); 27 | 28 | String labelString = "has element number ${number}"; 29 | if (context.getTemplate().getLabel(iri) != null) { 30 | labelString = context.getTemplate().getLabel(iri); 31 | } 32 | String description = "This relation links a sequence/list to its element at position " + number + "."; 33 | if (labelString.contains(" - ")) description = labelString.replaceFirst("^.* - ", ""); 34 | String label = labelString.replaceFirst(" - .*$", ""); 35 | label = label.replaceAll("\\$\\{number\\}", number + ""); 36 | 37 | add(new Label("description", description)); 38 | add(Utils.getUriLink("uri", SEQUENCE_ELEMENT_PROPERTY_PREFIX + number)); 39 | 40 | add(new ExternalLink("text", "", label)); 41 | } 42 | 43 | @Override 44 | public void removeFromContext() { 45 | } 46 | 47 | @Override 48 | public boolean isUnifiableWith(Value v) { 49 | if (v == null) return true; 50 | if (v instanceof Literal) return false; 51 | return v.stringValue().equals(SEQUENCE_ELEMENT_PROPERTY_PREFIX + number); 52 | } 53 | 54 | @Override 55 | public void unifyWith(Value v) throws UnificationException { 56 | if (v == null) return; 57 | if (!isUnifiableWith(v)) throw new UnificationException(v.stringValue()); 58 | } 59 | 60 | @Override 61 | public void fillFinished() { 62 | } 63 | 64 | @Override 65 | public void finalizeValues() { 66 | } 67 | 68 | public String toString() { 69 | return "[Sequence element]"; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/StatementItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | statement 14 | 15 |
16 | 17 |
18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/StatementPartItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | subj 13 | pred 14 | obj 15 | . 16 | 17 | + 18 | - 19 | 20 |
21 | label 22 | 23 |
24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/StatementPartItem.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import org.apache.wicket.markup.html.panel.Panel; 4 | 5 | public class StatementPartItem extends Panel { 6 | 7 | private static final long serialVersionUID = 1L; 8 | 9 | private final ValueItem subjItem, predItem, objItem; 10 | 11 | public StatementPartItem(String id, ValueItem subjItem, ValueItem predItem, ValueItem objItem) { 12 | super(id); 13 | this.subjItem = subjItem; 14 | this.predItem = predItem; 15 | this.objItem = objItem; 16 | add(subjItem); 17 | add(predItem); 18 | add(objItem); 19 | } 20 | 21 | public ValueItem getSubject() { 22 | return subjItem; 23 | } 24 | 25 | public ValueItem getPredicate() { 26 | return predItem; 27 | } 28 | 29 | public ValueItem getObject() { 30 | return objItem; 31 | } 32 | 33 | public String toString() { 34 | return subjItem + " " + predItem + " " + objItem; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/StatsPanel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
Nanopublication count
Latest versions:X
Previous versions:X
Accepted at journals:X
19 | 20 |
21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/StatsPanel.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import java.util.Map; 4 | 5 | import org.apache.wicket.markup.html.basic.Label; 6 | import org.apache.wicket.markup.html.panel.Panel; 7 | 8 | public class StatsPanel extends Panel { 9 | 10 | private static final long serialVersionUID = 1L; 11 | 12 | private Map statsMap; 13 | 14 | public StatsPanel(String id, String userId, String pubkeyHashes, Map statsMap) { 15 | super(id); 16 | this.statsMap = statsMap; 17 | setOutputMarkupId(true); 18 | 19 | add(new Label("latestcount", getLong("validNpCount"))); 20 | add(new Label("previouscount", getLong("invalidatedNpCount"))); 21 | add(new Label("acceptedcount", getLong("acceptedNpCount"))); 22 | } 23 | 24 | private long getLong(String key) { 25 | String value = statsMap.get(key); 26 | if (value == null) return 0l; 27 | return Long.parseLong(value); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/StatusLine.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

Status

11 |
12 |
13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/StatusLine.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import java.net.URLEncoder; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import org.apache.wicket.Component; 8 | import org.apache.wicket.markup.html.basic.Label; 9 | import org.apache.wicket.markup.html.panel.Panel; 10 | import org.nanopub.extra.services.ApiResponse; 11 | import org.nanopub.extra.services.ApiResponseEntry; 12 | 13 | import com.github.jsonldjava.shaded.com.google.common.base.Charsets; 14 | 15 | import net.trustyuri.TrustyUriUtils; 16 | 17 | public class StatusLine extends Panel { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | public static Component createComponent(String markupId, String npId) { 22 | // TODO Use the query cache here but with quicker refresh interval? 23 | ApiResultComponent c = new ApiResultComponent("statusline", "get-newer-versions-of-np", "np", npId) { 24 | 25 | private static final long serialVersionUID = 1L; 26 | 27 | @Override 28 | public Component getApiResultComponent(String markupId, ApiResponse response) { 29 | return new StatusLine(markupId, npId, response); 30 | } 31 | 32 | }; 33 | c.setWaitComponentHtml("

Status

" + ApiResultComponent.getWaitIconHtml() + "
"); 34 | return c; 35 | } 36 | 37 | public StatusLine(String markupId, String npId, ApiResponse response) { 38 | super(markupId); 39 | List latest = new ArrayList<>(); 40 | List retractions = new ArrayList<>(); 41 | for (ApiResponseEntry e : response.getData()) { 42 | String newerVersion = e.get("newerVersion"); 43 | String retractedBy = e.get("retractedBy"); 44 | String supersededBy = e.get("supersededBy"); 45 | if (retractedBy.isEmpty() && supersededBy.isEmpty()) { 46 | latest.add(newerVersion); 47 | } else if (!retractedBy.isEmpty() && supersededBy.isEmpty()) { 48 | retractions.add(retractedBy); 49 | } 50 | } 51 | String text = null; 52 | // TODO Improve HTML/link generation below (do it with Wicket Java code): 53 | if (latest.size() == 0 && retractions.size() == 0) { 54 | text = "This nanopublication doesn't seem to be properly published (yet). This can take a minute or two for new nanopublications."; 55 | } else if (latest.size() == 1) { 56 | String l = latest.get(0); 57 | if (l.equals(npId)) { 58 | text = "This is the latest version."; 59 | } else { 60 | text = "This nanopublication has a newer version: " + getLink(l); 61 | } 62 | } else if (latest.size() > 1) { 63 | text = "This nanopublication has newer versions:"; 64 | for (String l : latest) { 65 | text += " " + getLink(l); 66 | } 67 | } else { 68 | text = "This nanopublication has been retracted:"; 69 | for (String r : retractions) { 70 | text += " " + getLink(r); 71 | } 72 | } 73 | add(new Label("statusline", text).setEscapeModelStrings(false)); 74 | } 75 | 76 | private static String getLink(String npId) { 77 | String shortLabel = TrustyUriUtils.getArtifactCode(npId).substring(0, 10); 78 | String encodedLink = URLEncoder.encode(npId, Charsets.UTF_8); 79 | return "" + shortLabel + ""; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/TemplateItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | name - by user, timestamp 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/TemplateItem.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Calendar; 5 | 6 | import org.apache.wicket.markup.html.basic.Label; 7 | import org.apache.wicket.markup.html.link.BookmarkablePageLink; 8 | import org.apache.wicket.markup.html.panel.Panel; 9 | import org.apache.wicket.request.mapper.parameter.PageParameters; 10 | import org.eclipse.rdf4j.model.IRI; 11 | import org.nanopub.SimpleTimestampPattern; 12 | import org.nanopub.extra.security.NanopubSignatureElement; 13 | import org.nanopub.extra.security.SignatureUtils; 14 | 15 | import com.knowledgepixels.nanodash.User; 16 | import com.knowledgepixels.nanodash.page.PublishPage; 17 | import com.knowledgepixels.nanodash.template.Template; 18 | 19 | public class TemplateItem extends Panel { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public TemplateItem(String id, Template template) { 24 | this(id, template, null); 25 | } 26 | 27 | public TemplateItem(String id, Template template, PageParameters additionalParams) { 28 | super(id); 29 | 30 | PageParameters params = new PageParameters(); 31 | params.add("template", template.getId()); 32 | params.add("template-version", "latest"); 33 | if (additionalParams != null) params.mergeWith(additionalParams); 34 | BookmarkablePageLink l = new BookmarkablePageLink("link", PublishPage.class, params); 35 | l.add(new Label("name", template.getLabel())); 36 | add(l); 37 | String userString = "somebody"; 38 | try { 39 | NanopubSignatureElement se = SignatureUtils.getSignatureElement(template.getNanopub()); 40 | if (se != null) { 41 | IRI signer = (se.getSigners().isEmpty() ? null : se.getSigners().iterator().next()); 42 | userString = User.getShortDisplayName(signer, se.getPublicKeyString()); 43 | } 44 | } catch (Exception ex) { 45 | ex.printStackTrace(); 46 | } 47 | add(new Label("user", userString)); 48 | String timeString = "unknown date"; 49 | Calendar c = SimpleTimestampPattern.getCreationTime(template.getNanopub()); 50 | if (c != null) { 51 | timeString = (new SimpleDateFormat("yyyy-MM-dd")).format(c.getTime()); 52 | } 53 | add(new Label("timestamp", timeString)); 54 | 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/TemplateList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 | 15 |

Popular Templates

16 | 17 |
18 |
19 | 20 |
21 | 22 |
23 | 24 |

Suggested Templates to Get Started

25 | 26 |
27 |
28 | 29 |
30 | 31 |
32 | 33 |
34 | 35 |
36 | 37 |

All Templates

38 | 39 |
40 | 41 |
42 |

title

43 |
    44 |
  • template
  • 45 |
46 |
47 | 48 |
49 | 50 |
51 | 52 |
53 | 54 |
55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/TemplateResults.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
    12 |
  • 13 |
14 | 15 |
16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/java/com/knowledgepixels/nanodash/component/TemplateResults.java: -------------------------------------------------------------------------------- 1 | package com.knowledgepixels.nanodash.component; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.apache.wicket.markup.html.panel.Panel; 7 | import org.apache.wicket.markup.repeater.Item; 8 | import org.apache.wicket.markup.repeater.data.DataView; 9 | import org.apache.wicket.markup.repeater.data.ListDataProvider; 10 | import org.apache.wicket.request.mapper.parameter.PageParameters; 11 | import org.nanopub.extra.services.ApiResponse; 12 | import org.nanopub.extra.services.ApiResponseEntry; 13 | 14 | import com.knowledgepixels.nanodash.template.Template; 15 | import com.knowledgepixels.nanodash.template.TemplateData; 16 | 17 | public class TemplateResults extends Panel { 18 | 19 | private static final long serialVersionUID = -5109507637942030910L; 20 | 21 | public static TemplateResults fromList(String id, List