| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| # Digital Book Library on a Pod | ||
|
|
||
| You are building the next-generation digital book library based on Solid. You can think about some similar services such as Goodreads and Audible personalized to your experience. To start you must implement a prototype first, a command-line interface application that only works for your user. | ||
|
|
||
| ## How to get the example to run | ||
|
|
||
| The example web application expects as of now a `{podStorage}` link. Make sure you replace it in the `Vocabulary.java`. | ||
| Make sure you have a book library resource in the location `{podStorage}/MyBookLibrary/bookLibResource.ttl`. See example below at The book model section. | ||
|
|
||
| ## The following user stories (US) will help: | ||
|
|
||
| * US1: As a digital book library owner I want to see all the publicly available books I have in my Digital Book Library. | ||
| * US2: As a digital book library owner I want to see all the books which have a specified title. | ||
|
|
||
|
|
||
| ## Vocabulary | ||
|
|
||
| ``` | ||
| @prefix vocabulary: <{podStorage}/MyBookLibrary/bookLibraryVocabulary#> . | ||
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
| @prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
| @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
|
||
| ### | ||
| # Ontology metadata | ||
| ### | ||
|
|
||
| <{podStorage}/MyBookLibrary/bookLibraryVocabulary.ttl> a owl:Ontology . | ||
|
|
||
| ### | ||
| # Ontology classes | ||
| ### | ||
|
|
||
| vocabulary:BookLibrary a owl:Class; | ||
| rdfs:label "Book Library" . | ||
|
|
||
| vocabulary:Book a owl:Class; | ||
| rdfs:label "Book" . | ||
|
|
||
| ### | ||
| # Ontology relations | ||
| ### | ||
|
|
||
| vocabulary:containsBook a owl:DatatypeProperty; | ||
| rdfs:label "contains book"@en; | ||
| rdfs:domain vocabulary:BookLibrary; | ||
| rdfs:range vocabulary:Book . | ||
|
|
||
| ### | ||
| # Ontology attributes which are also relationships but range is rdfs:Resource or others. | ||
| ### | ||
|
|
||
| vocabulary:author a owl:DatatypeProperty; | ||
| rdfs:label "book author"@en; | ||
| rdfs:domain vocabulary:Book; | ||
| rdfs:range xsd:string . | ||
|
|
||
| vocabulary:description a owl:DatatypeProperty; | ||
| rdfs:label "book description"@en; | ||
| rdfs:domain vocabulary:Book; | ||
| rdfs:range xsd:string . | ||
|
|
||
| ``` | ||
|
|
||
|
|
||
| ## Data Model | ||
|
|
||
| `podStorage` is the root of a user's storage. We choose to write the Book Library data on the storage in a container called `bookLibrary`. Together the form the base for where the data is stored on a user's storage: `podStorage/bookLibrary`. | ||
| Data model design choice: by the Book being part of the BookLibrary resource directly we express implicitly that the Book is part of only this library. For integration into other libraries one can add the Book triples into the new BookLibrary resource or consider a vocabulary with a dedicated relation (ex: contains book) and dedicated resources per Book. | ||
|
|
||
| ### The Book model | ||
|
|
||
| ``` | ||
| @prefix book: <{podStorage}/MyBookLibrary/bookLibResource.ttl#> . | ||
| @prefix vocabulary: <{podStorage}/MyBookLibrary/bookLibraryVocabulary#> . | ||
| @prefix dc: <http://purl.org/dc/elements/1.1/> . | ||
| @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
|
||
| <{podStorage}/MyBookLibrary/bookLibResource.ttl> a vocabulary:BookLibrary ; | ||
| vocabulary:containsBook book:uuid1; | ||
| vocabulary:containsBook book:uuid2; | ||
| vocabulary:containsBook book:uuid3; | ||
| vocabulary:containsBook book:uuid4. | ||
|
|
||
| book:uuid1 a vocabulary:Book ; | ||
| dc:title "Dracula" ; | ||
| vocabulary:author "Bram Stoker" . | ||
|
|
||
| book:uuid2 a vocabulary:Book; | ||
| dc:title "Little Women" ; | ||
| vocabulary:author "May Alcott" . | ||
|
|
||
| book:uuid3 a vocabulary:Book; | ||
| dc:title "The graveyard book" ; | ||
| vocabulary:author "Neil Gaiman" . | ||
|
|
||
| book:uuid4 a vocabulary:Book; | ||
| dc:title "The alchemist" ; | ||
| vocabulary:author "Paulo Coelho" . | ||
|
|
||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| <?xml version="1.0"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <groupId>com.inrupt</groupId> | ||
| <artifactId>inrupt-client-examples-parent</artifactId> | ||
| <version>1.0.0-SNAPSHOT</version> | ||
| </parent> | ||
|
|
||
| <artifactId>inrupt-client-examples-springboot</artifactId> | ||
| <version>1.0.0-SNAPSHOT</version> | ||
| <name>Inrupt Java Client Libraries - Spring Boot Example</name> | ||
| <description> | ||
| Sample Spring Boot application. | ||
| </description> | ||
|
|
||
| <properties> | ||
| <maven.compiler.target>17</maven.compiler.target> | ||
| <maven.compiler.source>17</maven.compiler.source> | ||
|
|
||
| <springboot.version>3.0.4</springboot.version> | ||
| </properties> | ||
|
|
||
| <dependencyManagement> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-dependencies</artifactId> | ||
| <version>${springboot.version}</version> | ||
| <type>pom</type> | ||
| <scope>import</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| </dependencyManagement> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.inrupt</groupId> | ||
| <artifactId>inrupt-client-api</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.inrupt</groupId> | ||
| <artifactId>inrupt-client-jena</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.inrupt</groupId> | ||
| <artifactId>inrupt-client-okhttp</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.inrupt</groupId> | ||
| <artifactId>inrupt-client-jackson</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.inrupt</groupId> | ||
| <artifactId>inrupt-client-core</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.inrupt</groupId> | ||
| <artifactId>inrupt-client-solid</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.inrupt</groupId> | ||
| <artifactId>inrupt-client-vocabulary</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-web</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-thymeleaf</artifactId> | ||
| </dependency> | ||
| <!-- for development use, such as restart app when any changes --> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-devtools</artifactId> | ||
| <optional>true</optional> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <!-- for building a jar --> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-maven-plugin</artifactId> | ||
| <executions> | ||
| <execution> | ||
| <goals> | ||
| <goal>repackage</goal> | ||
| </goals> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright 2023 Inrupt Inc. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal in | ||
| * the Software without restriction, including without limitation the rights to use, | ||
| * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the | ||
| * Software, and to permit persons to whom the Software is furnished to do so, | ||
| * subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
| * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | ||
| * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
| * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
| * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
| * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| */ | ||
| package com.inrupt.client.examples.springboot; | ||
|
|
||
| import org.springframework.boot.SpringApplication; | ||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
|
||
| @SuppressWarnings({"PMD", "checkstyle:hideutilityclassconstructor"}) | ||
| @SpringBootApplication | ||
| public class Application { | ||
|
|
||
| public static void main(final String[] args) { | ||
| SpringApplication.run(Application.class, args); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Copyright 2023 Inrupt Inc. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal in | ||
| * the Software without restriction, including without limitation the rights to use, | ||
| * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the | ||
| * Software, and to permit persons to whom the Software is furnished to do so, | ||
| * subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
| * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | ||
| * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
| * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
| * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
| * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| */ | ||
| package com.inrupt.client.examples.springboot; | ||
|
|
||
| import org.springframework.stereotype.Controller; | ||
| import org.springframework.ui.Model; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.RequestParam; | ||
|
|
||
| @Controller | ||
| public class ApplicationStartController { | ||
|
|
||
| @GetMapping("/") | ||
| public String index() { | ||
| return "index"; | ||
| } | ||
|
|
||
| @GetMapping("/login") | ||
| public String login(@RequestParam(name = "message", required = false, defaultValue = "Under construction") | ||
| final String message, final Model model) { | ||
| model.addAttribute("message", message); | ||
| return "index"; | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Copyright 2023 Inrupt Inc. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal in | ||
| * the Software without restriction, including without limitation the rights to use, | ||
| * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the | ||
| * Software, and to permit persons to whom the Software is furnished to do so, | ||
| * subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
| * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | ||
| * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
| * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
| * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
| * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| */ | ||
| package com.inrupt.client.examples.springboot; | ||
|
|
||
| import com.inrupt.client.examples.springboot.model.Book; | ||
|
|
||
| import java.util.Set; | ||
|
|
||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.stereotype.Controller; | ||
| import org.springframework.ui.Model; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.RequestParam; | ||
|
|
||
| @Controller | ||
| public class BookLibraryController { | ||
|
|
||
| @Autowired | ||
| private BookLibraryService bookLibService; | ||
|
|
||
| @GetMapping("/allbooks") | ||
| public String books(final Model model ) { | ||
| model.addAttribute("allBooks", bookLibService.getAllBooks()); | ||
| return "index"; | ||
| } | ||
|
|
||
| @GetMapping("/bookbytitle") | ||
| public String bookbytitle(@RequestParam(value = "title", defaultValue = "Dracula") | ||
| final String title, final Model model) { | ||
| final Set<Book> result = bookLibService.getBookForTitle(title); | ||
| if (!result.isEmpty()) { | ||
| model.addAttribute("booksByTitle", result); | ||
| } else { | ||
| model.addAttribute("error", "Did not find the book"); | ||
| } | ||
| return "index"; | ||
| } | ||
| } |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIs this really intentionally here, committed in source?
Or is it just so you can get on with your dev?
If latter, I can show you nicer (not polluting source) ways of being in control of what you run when using Maven profiles.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis is intentional. The examples are not released and are intended only to be example code for developers. As such, Spring and Quarkus both bring in many, many transitive dependencies. In the case of Spring, we are currently stuck on spring boot 2.x because 3.x requires Java 17. And the dependency check becomes just a distraction without providing any value. Of course, it is turned on everywhere else: this configuration only applies to the examples directory.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.