Skip to content

Instantly share code, notes, and snippets.

@afs
afs / rules-spec.md
Last active August 11, 2025 14:47
Sketch of SHACL Rules doc

Warning : this document is out of date and is not being updated

Please direct comments to https://github.com/w3c/data-shapes/issues


SHACL Rules

SHACL rules infer new triples. The input is a data graph and a shape graph with rules, the output is a graph of inferred triples that do not occur in the data graph.

@afs
afs / sql-correlated-example.md
Last active August 6, 2025 19:47
SQL de-correlation example
@afs
afs / notes2.md
Last active August 11, 2025 14:47
Notes on SHACL Rules
@afs
afs / config.ttl
Last active October 1, 2024 09:07
Fuseki configuration : RDFS + union default graph variants
PREFIX : <#>
PREFIX fuseki: <http://jena.apache.org/fuseki#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
PREFIX tdb2: <http://jena.apache.org/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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>SHACL-C Grammar</title>
<link rel="stylesheet" type="text/css" href="https://www.w3.org/StyleSheets/TR/base.css" />
<link rel="stylesheet" type="text/css" href="https://www.w3.org/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: <http://datashapes.org/dash#> .
## @prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
## @prefix tosh: <http://topbraid.org/tosh#> .
## @prefix xsd: <http://www.w3.org/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
*
* http://www.apache.org/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
http://www.apache.org/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.