├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ ├── deno-test.yml │ └── npm-publish.yml ├── examples ├── next-movie-database │ ├── data │ │ ├── utils.ts │ │ ├── options.ts │ │ ├── namespaces.ts │ │ └── lens.ts │ ├── .eslintrc.json │ ├── components │ │ ├── Loading.tsx │ │ ├── Thumbnail.tsx │ │ ├── Footer.tsx │ │ ├── Links.tsx │ │ ├── TypesView.tsx │ │ └── Header.tsx │ ├── app │ │ ├── favicon.ico │ │ ├── globals.css │ │ ├── layout.tsx │ │ ├── search │ │ │ └── page.tsx │ │ └── movie │ │ │ └── page.tsx │ ├── next.config.js │ ├── postcss.config.js │ ├── .vscode │ │ └── settings.json │ ├── tailwind.config.ts │ ├── README.md │ ├── .gitignore │ ├── public │ │ ├── vercel.svg │ │ └── next.svg │ ├── tsconfig.json │ └── package.json ├── react-dbpedia-actors │ ├── src │ │ ├── vite-env.d.ts │ │ ├── main.tsx │ │ ├── App.tsx │ │ ├── store.ts │ │ ├── Actor.tsx │ │ └── Actors.tsx │ ├── vite.config.ts │ ├── tsconfig.node.json │ ├── index.html │ ├── tsconfig.json │ └── package.json ├── react-query-todo-app │ ├── src │ │ ├── vite-env.d.ts │ │ ├── main.tsx │ │ ├── store.ts │ │ └── components │ │ │ ├── App.tsx │ │ │ ├── UI.tsx │ │ │ ├── Icons.tsx │ │ │ ├── Add.tsx │ │ │ └── Items.tsx │ ├── vite.config.ts │ ├── tsconfig.node.json │ ├── index.html │ ├── semantics │ │ ├── todo_schema.shex │ │ ├── todo_schema.ts │ │ └── todo_ontology.ttl │ ├── tsconfig.json │ ├── README.md │ └── package.json ├── custom-query │ ├── deno.json │ ├── store.ts │ └── main.ts ├── import_map.json ├── react-bulletin-boards │ ├── vite.config.ts │ ├── tsconfig.node.json │ ├── src │ │ ├── vite-env.d.ts │ │ ├── main.tsx │ │ ├── App.tsx │ │ ├── Form.tsx │ │ └── store.ts │ ├── index.html │ ├── tsconfig.json │ └── package.json └── basic │ ├── deno.json │ ├── inverse.ts │ ├── main.ts │ └── arrays.ts ├── library ├── lens │ ├── mod.ts │ └── types.ts ├── utils.ts ├── engine │ ├── mod.ts │ ├── types.ts │ └── query_engine_proxy.ts ├── sparql │ ├── mod.ts │ ├── escape.ts │ ├── sparql_expression_builders.ts │ ├── stringify.ts │ ├── sparql_shared_builders.ts │ └── sparql_tag.ts ├── schema │ ├── search.ts │ ├── mod.ts │ ├── schema.ts │ └── data_types.ts ├── namespace.ts ├── options.ts └── translator.ts ├── scripts ├── dnt_import_map.json ├── generate_api.ts ├── extract_namespace.ts └── dnt.ts ├── docs ├── features │ ├── index.md │ ├── pagination.md │ ├── query-with-comunica.md │ ├── supported-data-types.md │ └── working-with-arrays.md ├── README.md ├── components │ ├── index.md │ ├── query-engine.md │ └── options.md ├── table-of-contents.json ├── about-ldkit │ └── index.md └── getting-started │ └── index.md ├── www ├── static │ ├── favicon.ico │ └── examples │ │ ├── person.shex │ │ └── person.jsonld ├── dev.ts ├── data │ ├── api.ts │ ├── steps.md │ └── docs.ts ├── README.md ├── fresh.config.ts ├── components │ ├── Jumbo.tsx │ ├── Button.tsx │ ├── App.tsx │ ├── Footer.tsx │ ├── Header.tsx │ └── Icons.tsx ├── utils │ ├── markdown.ts │ └── doc.ts ├── routes │ ├── _404.tsx │ ├── _app.tsx │ ├── gfm.css.ts │ └── ontology │ │ ├── index.tsx │ │ ├── IRI.tsx │ │ └── Resource.tsx ├── twind.config.ts ├── main.ts ├── deno.json ├── fresh.gen.ts └── doc.config.ts ├── .gitignore ├── performance ├── benchmark │ ├── deno.json │ ├── common.ts │ ├── results.csv │ ├── results_overhead.csv │ ├── overhead.ts │ ├── populate.ts │ ├── csv.ts │ ├── csv_overhead.ts │ ├── mocks.ts │ └── README.md └── dbpedia │ ├── deno.json │ ├── scenario1.ts │ ├── README.md │ ├── scenario2.ts │ ├── scenario3.ts │ └── common.ts ├── tests ├── test_deps.ts ├── sparql_expression_builders.test.ts ├── rdf.test.ts ├── treeiterator.test.ts ├── e2e │ ├── dbpedia.test.ts │ ├── rdf_types.test.ts │ ├── custom_data_types.test.ts │ ├── inverse.test.ts │ └── multilang.test.ts ├── engine.test.ts └── lens_pagination.test.ts ├── namespaces ├── ldkit.ts ├── dc.ts ├── rdfs.ts ├── rdf.ts ├── skos.ts ├── xsd.ts ├── foaf.ts ├── dcterms.ts ├── sioc.ts └── owl.ts ├── sparql.ts ├── .vscode ├── settings.json └── import_map.json ├── mod.ts ├── deno.json ├── rdf.ts ├── CITATION.cff ├── LICENSE └── namespaces.ts /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: karelklima 2 | -------------------------------------------------------------------------------- /examples/next-movie-database/data/utils.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /library/lens/mod.ts: -------------------------------------------------------------------------------- 1 | export * from "./lens.ts"; 2 | -------------------------------------------------------------------------------- /scripts/dnt_import_map.json: -------------------------------------------------------------------------------- 1 | { 2 | "imports": { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /library/utils.ts: -------------------------------------------------------------------------------- 1 | export { readableFromWeb } from "npm:readable-from-web@^1"; 2 | -------------------------------------------------------------------------------- /docs/features/index.md: -------------------------------------------------------------------------------- 1 | # Advanced LDkit usage 2 | 3 | Select topic from the menu. 4 | -------------------------------------------------------------------------------- /examples/react-dbpedia-actors/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/react-query-todo-app/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /library/engine/mod.ts: -------------------------------------------------------------------------------- 1 | export * from "./query_engine.ts"; 2 | export * from "./types.ts"; 3 | -------------------------------------------------------------------------------- /www/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelklima/ldkit/main/www/static/favicon.ico -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | npm 2 | dist 3 | node_modules 4 | .parcel-cache 5 | 6 | package-lock.json 7 | ontologies 8 | -------------------------------------------------------------------------------- /examples/next-movie-database/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["next", "next/core-web-vitals", "prettier"] 3 | } 4 | -------------------------------------------------------------------------------- /examples/next-movie-database/components/Loading.tsx: -------------------------------------------------------------------------------- 1 | export function Loading() { 2 | return

Loading...

; 3 | } 4 | -------------------------------------------------------------------------------- /examples/next-movie-database/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelklima/ldkit/main/examples/next-movie-database/app/favicon.ico -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # LDkit documentation 2 | 3 | This is the LDkit documentation source. You can see it live at 4 | [ldkit.io](https://ldkit.io). 5 | -------------------------------------------------------------------------------- /examples/next-movie-database/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {} 3 | 4 | module.exports = nextConfig 5 | -------------------------------------------------------------------------------- /examples/next-movie-database/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /www/dev.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S deno run -A --watch=static/,routes/ 2 | 3 | import dev from "$fresh/dev.ts"; 4 | 5 | await dev(import.meta.url, "./main.ts"); 6 | -------------------------------------------------------------------------------- /www/data/api.ts: -------------------------------------------------------------------------------- 1 | import RAW_API from "../../docs/api.json" with { type: "json" }; 2 | 3 | export type Api = typeof RAW_API; 4 | 5 | export const api: Api = RAW_API; 6 | -------------------------------------------------------------------------------- /examples/next-movie-database/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "editor.defaultFormatter": "esbenp.prettier-vscode", 4 | "editor.tabSize": 2 5 | } 6 | -------------------------------------------------------------------------------- /examples/custom-query/deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "importMap": "../import_map.json", 3 | "tasks": { 4 | "main": "deno run --allow-net --allow-env ./main.ts" 5 | }, 6 | "lock": false 7 | } 8 | -------------------------------------------------------------------------------- /examples/import_map.json: -------------------------------------------------------------------------------- 1 | { 2 | "imports": { 3 | "ldkit": "../mod.ts", 4 | "ldkit/namespaces": "../namespaces.ts", 5 | "ldkit/sparql": "../sparql.ts", 6 | "ldkit/rdf": "../rdf.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /www/README.md: -------------------------------------------------------------------------------- 1 | # LDkit website 2 | 3 | This is the LDkit website source. You can see it live at 4 | [ldkit.io](https://ldkit.io). 5 | 6 | [![Made with Fresh](https://fresh.deno.dev/fresh-badge-dark.svg)](https://fresh.deno.dev) 7 | -------------------------------------------------------------------------------- /examples/react-bulletin-boards/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | }) 8 | -------------------------------------------------------------------------------- /examples/react-dbpedia-actors/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite"; 2 | import react from "@vitejs/plugin-react"; 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | }); 8 | -------------------------------------------------------------------------------- /examples/react-query-todo-app/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | }) 8 | -------------------------------------------------------------------------------- /examples/next-movie-database/data/options.ts: -------------------------------------------------------------------------------- 1 | import { type Options } from "ldkit"; 2 | 3 | export const options: Options = { 4 | source: "https://dbpedia.org/sparql", 5 | language: "en", 6 | logQuery: (query) => console.log("SPARQL QUERY", query), 7 | }; 8 | -------------------------------------------------------------------------------- /library/sparql/mod.ts: -------------------------------------------------------------------------------- 1 | export * from "./sparql_tag.ts"; 2 | export { ASK, CONSTRUCT, DESCRIBE, SELECT } from "./sparql_query_builders.ts"; 3 | export { DELETE, INSERT, WITH } from "./sparql_update_builders.ts"; 4 | export * from "./sparql_expression_builders.ts"; 5 | -------------------------------------------------------------------------------- /www/fresh.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "$fresh/server.ts"; 2 | import twindPlugin from "$fresh/plugins/twind.ts"; 3 | import twindConfig from "./twind.config.ts"; 4 | 5 | export default defineConfig({ 6 | plugins: [twindPlugin(twindConfig)], 7 | }); 8 | -------------------------------------------------------------------------------- /examples/react-dbpedia-actors/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "module": "ESNext", 5 | "moduleResolution": "Node", 6 | "allowSyntheticDefaultImports": true 7 | }, 8 | "include": ["vite.config.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /examples/react-query-todo-app/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "module": "ESNext", 5 | "moduleResolution": "Node", 6 | "allowSyntheticDefaultImports": true 7 | }, 8 | "include": ["vite.config.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /examples/react-bulletin-boards/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "module": "ESNext", 5 | "moduleResolution": "Node", 6 | "allowSyntheticDefaultImports": true 7 | }, 8 | "include": ["vite.config.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /examples/basic/deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "importMap": "../import_map.json", 3 | "tasks": { 4 | "main": "deno run --allow-net --allow-env ./main.ts", 5 | "arrays": "deno run -A ./arrays.ts", 6 | "inverse": "deno run -A ./inverse.ts" 7 | }, 8 | "lock": false 9 | } 10 | -------------------------------------------------------------------------------- /performance/benchmark/deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "imports": { 3 | "ldkit": "../../mod.ts" 4 | }, 5 | "tasks": { 6 | "test": "deno run --allow-net --allow-env --allow-write ./test.ts", 7 | "populate": "deno run --allow-net --allow-env ./populate.ts" 8 | }, 9 | "lock": false 10 | } 11 | -------------------------------------------------------------------------------- /examples/next-movie-database/components/Thumbnail.tsx: -------------------------------------------------------------------------------- 1 | export function Thumbnail({ imageUrl }: { imageUrl: string | null }) { 2 | if (!imageUrl) { 3 | return
No image found
; 4 | } 5 | return ( 6 |
7 | thumbnail 8 |
9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /examples/react-bulletin-boards/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.svg" { 2 | import * as React from "react"; 3 | 4 | export const ReactComponent: React.FunctionComponent< 5 | React.SVGProps & { title?: string } 6 | >; 7 | 8 | const src: string; 9 | export default src; 10 | } 11 | -------------------------------------------------------------------------------- /examples/react-bulletin-boards/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | 4 | import { App } from "./App"; 5 | 6 | ReactDOM.createRoot(document.getElementById("app") as HTMLElement).render( 7 | 8 | 9 | , 10 | ); 11 | -------------------------------------------------------------------------------- /examples/react-dbpedia-actors/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | 4 | import { App } from "./App"; 5 | 6 | ReactDOM.createRoot(document.getElementById("app") as HTMLElement).render( 7 | 8 | 9 | , 10 | ); 11 | -------------------------------------------------------------------------------- /examples/react-query-todo-app/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | 4 | import { App } from "./components/App"; 5 | 6 | ReactDOM.createRoot(document.getElementById("app") as HTMLElement).render( 7 | 8 | 9 | , 10 | ); 11 | -------------------------------------------------------------------------------- /tests/test_deps.ts: -------------------------------------------------------------------------------- 1 | export { 2 | assert, 3 | assertEquals, 4 | assertRejects, 5 | assertStrictEquals, 6 | assertThrows, 7 | equal, 8 | } from "$std/assert/mod.ts"; 9 | 10 | export { assert as assertTypeSafe, type Equals } from "npm:tsafe@^1.8.5"; 11 | 12 | export { QueryEngine as Comunica } from "npm:@comunica/query-sparql-rdfjs@^4.3.0"; 13 | -------------------------------------------------------------------------------- /examples/next-movie-database/data/namespaces.ts: -------------------------------------------------------------------------------- 1 | import { createNamespace } from "ldkit"; 2 | 3 | export const yago = createNamespace({ 4 | iri: "http://dbpedia.org/class/yago/", 5 | prefix: "yago:", 6 | terms: [ 7 | "Actor109765278", 8 | "Composer109947232", 9 | "Director110014939", 10 | "Writer110794014", 11 | ], 12 | } as const); 13 | -------------------------------------------------------------------------------- /namespaces/ldkit.ts: -------------------------------------------------------------------------------- 1 | import { createNamespace } from "../library/namespace.ts"; 2 | 3 | /** 4 | * LDkit Ontology 5 | * 6 | * `@ldkit: `, 7 | */ 8 | export const ldkit = createNamespace( 9 | { 10 | iri: "https://ldkit.io/ontology/", 11 | prefix: "ldkit:", 12 | terms: ["Resource", "IRI"], 13 | } as const, 14 | ); 15 | -------------------------------------------------------------------------------- /www/components/Jumbo.tsx: -------------------------------------------------------------------------------- 1 | import { ComponentChildren } from "preact"; 2 | 3 | type JumboProps = { 4 | children: ComponentChildren; 5 | }; 6 | 7 | export function Jumbo({ children }: JumboProps) { 8 | return ( 9 |

10 | {children} 11 |

12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /examples/react-bulletin-boards/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Úřední desky 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /www/components/Button.tsx: -------------------------------------------------------------------------------- 1 | import { JSX } from "preact"; 2 | import { IS_BROWSER } from "$fresh/runtime.ts"; 3 | 4 | export function Button(props: JSX.HTMLAttributes) { 5 | return ( 6 | 26 | 27 | 28 | 29 | 30 | ); 31 | -------------------------------------------------------------------------------- /namespaces/rdfs.ts: -------------------------------------------------------------------------------- 1 | import { createNamespace } from "../library/namespace.ts"; 2 | 3 | /** 4 | * The RDF Schema vocabulary (RDFS) 5 | * 6 | * `@rdfs: `, 7 | */ 8 | export const rdfs = createNamespace( 9 | { 10 | iri: "http://www.w3.org/2000/01/rdf-schema#", 11 | prefix: "rdfs:", 12 | terms: [ 13 | "Class", 14 | "Container", 15 | "ContainerMembershipProperty", 16 | "Datatype", 17 | "Literal", 18 | "Resource", 19 | "comment", 20 | "domain", 21 | "isDefinedBy", 22 | "label", 23 | "member", 24 | "range", 25 | "seeAlso", 26 | "subClassOf", 27 | "subPropertyOf", 28 | ], 29 | } as const, 30 | ); 31 | -------------------------------------------------------------------------------- /examples/next-movie-database/components/Links.tsx: -------------------------------------------------------------------------------- 1 | import { ArrowTopRightOnSquareIcon } from "@heroicons/react/16/solid"; 2 | 3 | export function Links({ iri }: { iri: string }) { 4 | return ( 5 | <> 6 |

7 | 8 | DBpedia 9 | 10 |

11 |

12 | 13 | Wikipedia 14 | 15 |

16 | 17 | ); 18 | } 19 | 20 | function getWikipediaLink(iri: string) { 21 | return iri.replace( 22 | "http://dbpedia.org/resource/", 23 | "https://wikipedia.org/en/" 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /examples/next-movie-database/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /examples/react-dbpedia-actors/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Karel Klima (https://karelklima.com)", 3 | "license": "MIT", 4 | "type": "module", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "tsc && vite build", 8 | "preview": "vite preview" 9 | }, 10 | "dependencies": { 11 | "@emotion/react": "^11.11.1", 12 | "@emotion/styled": "^11.11.0", 13 | "@mui/material": "^5.14.18", 14 | "ldkit": "^2.1.0", 15 | "react": "^18.2.0", 16 | "react-dom": "^18.2.0" 17 | }, 18 | "devDependencies": { 19 | "@types/react": "^18.2.37", 20 | "@types/react-dom": "^18.2.15", 21 | "@vitejs/plugin-react": "^4.2.0", 22 | "typescript": "^5.5.0", 23 | "vite": "^4.5.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.vscode/import_map.json: -------------------------------------------------------------------------------- 1 | { 2 | "imports": { 3 | "$fresh/": "https://deno.land/x/fresh@1.6.1/", 4 | "preact": "https://esm.sh/preact@10.19.2", 5 | "preact/": "https://esm.sh/preact@10.19.2/", 6 | "@preact/signals": "https://esm.sh/*@preact/signals@1.2.1", 7 | "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.0", 8 | "twind": "https://esm.sh/twind@0.16.19", 9 | "twind/": "https://esm.sh/twind@0.16.19/", 10 | "$doc_components/": "https://deno.land/x/deno_doc_components@0.4.14/", 11 | 12 | "$std/": "https://deno.land/std@0.207.0/", 13 | 14 | "ldkit": "../mod.ts", 15 | "ldkit/namespaces": "../namespaces.ts", 16 | "ldkit/sparql": "../sparql.ts", 17 | "ldkit/rdf": "../rdf.ts" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/react-query-todo-app/README.md: -------------------------------------------------------------------------------- 1 | # TODO app with custom semantics 2 | 3 | This is an example TODO list application with an RDF data model based on a 4 | custom ontology. 5 | 6 | The goal of this application is to showcase how to incorporate advanced 7 | semantics into Linked Data applications. 8 | 9 | Semantics elements: 10 | 11 | - Ontology: [./semantics/todo_ontology.ttl](./semantics/todo_ontology.ttl) 12 | - ShEx schema: [./semantics/todo_schema.shex](./semantics/todo_schema.shex) 13 | - LDkit schema: [./semantics/todo_schema.ts](./semantics/todo_schema.ts) 14 | 15 | The ShEx schema is built using the custom ontology. LDkit schema is then built 16 | using the ShEx schema. 17 | 18 | ## How to run the application 19 | 20 | ``` 21 | npm install 22 | npm run dev 23 | ``` 24 | -------------------------------------------------------------------------------- /examples/react-query-todo-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Karel Klima (https://karelklima.com)", 3 | "license": "MIT", 4 | "type": "module", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "tsc && vite build", 8 | "preview": "vite preview" 9 | }, 10 | "dependencies": { 11 | "@comunica/query-sparql-rdfjs": "^4.1.0", 12 | "@emotion/react": "^11.11.1", 13 | "@emotion/styled": "^11.11.0", 14 | "@tanstack/react-query": "^5.8.4", 15 | "ldkit": "^2.1.0", 16 | "react": "^18.2.0", 17 | "react-dom": "^18.2.0" 18 | }, 19 | "devDependencies": { 20 | "@types/react": "^18.2.37", 21 | "@types/react-dom": "^18.2.15", 22 | "@vitejs/plugin-react": "^4.2.0", 23 | "typescript": "^5.5.0", 24 | "vite": "^4.5.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /performance/dbpedia/README.md: -------------------------------------------------------------------------------- 1 | # DBpedia performance suite 2 | 3 | This test suite include a set of tests that query data from DBpedia SPARQL 4 | endpoint. There are three scenarios, ranging from the most simple one to the 5 | most complex. 6 | 7 | Please be aware that the test scenarios may timeout unexpectedly because of rate 8 | limiting of the public endpoint. 9 | 10 | Deno is required to run the test scenarios. 11 | 12 | ## 1) Install Deno 13 | 14 | Windows: 15 | 16 | ``` 17 | irm https://deno.land/install.ps1 | iex 18 | ``` 19 | 20 | MacOS/Linux: 21 | 22 | ``` 23 | curl -fsSL https://deno.land/install.sh | sh 24 | ``` 25 | 26 | ## 2) Run test scenarios 27 | 28 | ``` 29 | deno task scenario1 30 | ``` 31 | 32 | ``` 33 | deno task scenario2 34 | ``` 35 | 36 | ``` 37 | deno task scenario3 38 | ``` 39 | -------------------------------------------------------------------------------- /www/main.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | 7 | const startTime = performance.now(); 8 | 9 | import "$std/dotenv/load.ts"; 10 | 11 | import { start } from "$fresh/server.ts"; 12 | import manifest from "./fresh.gen.ts"; 13 | import config from "./fresh.config.ts"; 14 | 15 | const freshTime = performance.now(); 16 | 17 | import { setup } from "$doc_components/services.ts"; 18 | import docConfig from "./doc.config.ts"; 19 | 20 | await setup(docConfig); 21 | 22 | const docTime = performance.now(); 23 | 24 | console.log("Fresh time:", freshTime - startTime); 25 | console.log("Doc time:", docTime - freshTime); 26 | 27 | await start(manifest, config); 28 | -------------------------------------------------------------------------------- /performance/dbpedia/scenario2.ts: -------------------------------------------------------------------------------- 1 | import { createLens, dbo, dbp, options } from "./common.ts"; 2 | 3 | // Create a schema 4 | export const PersonSchema = { 5 | "@type": dbo.Person, 6 | name: dbo.birthName, 7 | } as const; 8 | 9 | export const ExtendedBookSchema = { 10 | "@type": dbo.Book, 11 | title: dbp.title, 12 | author: { 13 | "@id": dbp.author, 14 | "@schema": PersonSchema, 15 | }, 16 | } as const; 17 | 18 | // Create a resource using the data schema and context above 19 | const Lens = createLens(ExtendedBookSchema, options); 20 | 21 | // Fetch 1000 resources 22 | console.time("LDkit total time"); 23 | const entities = await Lens.find({ take: 1000 }); 24 | console.timeEnd("LDkit total time"); 25 | console.log("Number of results: ", entities.length); 26 | console.log("Sample entity", entities[0]); 27 | -------------------------------------------------------------------------------- /examples/next-movie-database/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import "./globals.css"; 3 | import { Header } from "@/components/Header"; 4 | import { Footer } from "@/components/Footer"; 5 | 6 | export const metadata: Metadata = { 7 | title: "Linked Data Movie Database", 8 | description: "Browse and search movies and actors from Wikidata", 9 | }; 10 | 11 | export default function RootLayout({ 12 | children, 13 | }: { 14 | children: React.ReactNode; 15 | }) { 16 | return ( 17 | 18 | 19 |
20 |
21 | {children} 22 |
23 |