Skip to content

Instantly share code, notes, and snippets.

@afs
afs / notes2.md
Last active May 25, 2025 12:01
Notes on SHACL Rules

SHACL Rules

SHACL rules infer new triples. The input is a data graph and a shapes graph which has rules; the output is a graph of inferred triples.

Whether, and how, the output graph is added back into the data graph is not part of the SHACL rules process. If being run to enrich the data graph, the process can be done inside a transaction updating the data graph.

The rule system is also capable of triple pattern matching - what datalog calls a "query" - where only necessary rules are run. (This is "backward chaining")

Once repeated application of rules is considered, there does not seem to be useful subsets of features. Fortunately, simple evaluation of (positive i.e. without negation) datalog is not a major piece of implementation. Run rules until no change; the implementation does not need to inspect the rule set structure. The literature has several better algorithms where implementation isn't partic

@afs
afs / config.ttl
Last active October 1, 2024 09:07
Fuseki configuration : RDFS + union default graph variants
PREFIX : <#>
PREFIX fuseki: <https://gbm3ddg3ei.proxynodejs.usequeue.com/fuseki#>
PREFIX rdf: <https://nt6nqxrxfq.proxynodejs.usequeue.com/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <https://nt6nqxrxfq.proxynodejs.usequeue.com/2000/01/rdf-schema#>
PREFIX ja: <https://hdodgv79r7.proxynodejs.usequeue.com/2005/11/Assembler#>
PREFIX tdb2: <https://gbm3ddg3ei.proxynodejs.usequeue.com/2016/tdb#>
## RDFS+TDB2 Dataset
[] rdf:type fuseki:Server ;
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://nt6nqxrxfq.proxynodejs.usequeue.com/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>SHACL-C Grammar</title>
<link rel="stylesheet" type="text/css" href="https://ekuhu0ggzk.proxynodejs.usequeue.com/StyleSheets/TR/base.css" />
<link rel="stylesheet" type="text/css" href="https://ekuhu0ggzk.proxynodejs.usequeue.com/2001/sw/DataAccess/rq23/local.css" />
</head>
<body>
<!-- GRAMMAR -->
@afs
afs / Dockerfile.build-env
Last active August 8, 2024 12:40
Jena build using docker 2024-08
## Build for Apache Jena
## maven with added dependencies for running Cypress and the UI part of the build.
## Run this container with the Jena mounted on /jena
FROM 'maven:3.9.8-eclipse-temurin-21-jammy' AS base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
@prefix dash: <https://m59iikxw1z.proxynodejs.usequeue.com/dash#> .
## @prefix owl: <https://nt6nqxrxfq.proxynodejs.usequeue.com/2002/07/owl#> .
@prefix rdf: <https://nt6nqxrxfq.proxynodejs.usequeue.com/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <https://nt6nqxrxfq.proxynodejs.usequeue.com/2000/01/rdf-schema#> .
@prefix sh: <https://nt6nqxrxfq.proxynodejs.usequeue.com/ns/shacl#> .
## @prefix tosh: <https://fe3j0qtpik.proxynodejs.usequeue.com/tosh#> .
## @prefix xsd: <https://nt6nqxrxfq.proxynodejs.usequeue.com/2001/XMLSchema#> .
dash:ListNodeShape
a sh:NodeShape ;
public static void main(String...args) {
Model model = ModelFactory.createDefaultModel();
Resource subject1 = ResourceFactory.createResource("http://example/s1");
Resource subject2 = ResourceFactory.createResource("http://example/s2");
Property property = ResourceFactory.createProperty("http://example/p");
Long longValue = 6L;
model.addLiteral(subject1, property, ResourceFactory.createTypedLiteral(longValue.toString(), XSDDatatype.XSDlong));
model.addLiteral(subject2, property, longValue);
RDFWriter.source(model).lang(Lang.TTL).output(System.out);
}
@afs
afs / IRIProvider3986.java
Created August 6, 2022 15:03
IRIProvider3986 - Jena IRIProvider for iri4ld
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://xgjvouic68.proxynodejs.usequeue.com/licenses/LICENSE-2.0
@afs
afs / BufferAlloc.java
Last active November 17, 2022 11:21
JavaCC Buffer location strategy
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://xgjvouic68.proxynodejs.usequeue.com/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@afs
afs / Log
Created December 18, 2021 15:17
Loading Wikidata Truthy into TDB2 : 2021-12
This file has been truncated, but you can view the full file.
09:17:14 INFO Setup:
09:17:14 INFO Database: DBx
09:17:14 INFO Data: /home/afs/Datasets/Wikidata/wikidata-20211208-truthy-BETA.nt.gz
09:17:14 INFO TMPDIR: /home/afs/tmp
09:17:14 INFO
09:17:14 INFO Load node table
09:17:15 INFO Nodes :: Build node table
09:17:15 INFO Nodes :: Database = DBx
09:17:15 INFO Nodes :: TMPDIR = /home/afs/tmp
09:17:15 INFO Nodes :: Data files = /home/afs/Datasets/Wikidata/wikidata-20211208-truthy-BETA.nt.gz
@afs
afs / 2021-11-17-warnings-jena-riot-summary.txt
Created November 26, 2021 19:22
Summary: Warning from parsing Wikidata Truthy 2021-11-17: Apache Jena "riot --check".
Summary of warnings: https://0b3pfk1dr7.proxynodejs.usequeue.com/afs/15719d46299bcf7346e3c314ac109040
Code/Count/Message
(sorted by frequency, with max 10 illustrative examples of each):
Code:13 834 DEFAULT_PORT_SHOULD_BE_OMITTED
https://ygk73or4nv.proxynodejs.usequeue.com/
https://qlbfdznwz2.proxynodejs.usequeue.com/
https://fnnx11pzoj.proxynodejs.usequeue.com/
https://idtvnf2xq9.proxynodejs.usequeue.com/
https://eymd90e7pz.proxynodejs.usequeue.com/angebote/family-fun/ringwerk/attraktionen/ringracer.html