Skip to content

Instantly share code, notes, and snippets.

@afs
afs / fuseki-jetty-https.xml
Last active February 23, 2018 16:34
A sample Jetty configuration file for HTTPS with Fuseki 2.3.1 and development versions including changes early Sept 2015 for update Jetty dependency.
** Live version: https://github.com/apache/jena/blob/master/jena-fuseki2/examples/fuseki-jetty-https.xml
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Get name="ThreadPool">
<Set name="minThreads" type="int"><Property name="jetty.threadPool.minThreads" deprecated="threads.min" default="10"/></Set>
@afs
afs / Apply.java
Created December 15, 2016 20:45
Box object to provide an apply capability.
public static class Select extends Query implements Function<Dataset, ResultSet> {
public Select(String string) {
QueryFactory.parse(this, string, null, Syntax.syntaxARQ);
}
@Override
public ResultSet apply(Dataset t) {
return QueryExecutionFactory.create(this, t).execSelect();
}
}
@afs
afs / script.sh
Created March 6, 2018 17:27
DER example (2108-03-06)
#!/bin/bash
echo "== Step 1a"
curl --header 'Accept: application/trig' http://localhost:3030/ds
echo "----"
s-put http://localhost:3030/ds/data http://localhost:3030/graph5 update.ttl
echo "== Step 1b"
curl --header 'Accept: application/trig' http://localhost:3030/ds
echo "----"
@afs
afs / script.sh
Last active March 7, 2018 17:17
DER example 2
#!/bin/bash
function dump_dataset() {
echo "<<<< ---- ----"
curl --header 'Accept: application/trig' http://localhost:3030/ds
echo ">>>> ---- ----"
}
echo "== Setup"
curl -s -d update="CLEAR ALL" http://localhost:3030/ds 1>/dev/null
@afs
afs / FuFunctionEx.java
Last active June 8, 2020 09:08
Example of a custom SPARQL function used in Fuseki.
/*
* Copyright 2018 Andy Seaborne
*
* 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
@afs
afs / convert_license.pl
Created April 28, 2019 14:30
Perl script to put the Apache contributed License header on java files.
#!/usr/bin/perl
# find . -name \*.java | xargs -n 1 perl -i.bak SCRIPT
# Licenses
# Apache, where the code is granted to the Apache Software Foundation.
$HEADER1=<<'EOF';
/*
* 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
@afs
afs / ExampleCustomDatatype.java
Created March 4, 2020 11:25
Example of a jena custom datatype.
/*
* 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 / log4j2.properties
Last active December 5, 2020 11:50
Example log4j2.properties for Apache Jena
## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
status = error
name = JenaLog4j2
appender.console.type = Console
appender.console.name = OUT
appender.console.target = SYSTEM_ERR
## appender.console.target = SYSTEM_OUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{HH:mm:ss} %-5p %-15c{1} :: %m%n
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX vcard: <http://www.w3.org/2001/vcard-rdf/3.0#>
PREFIX ns: <http://example.org/ns#>
PREFIX : <http://example.org/book/>
# This data is intentionaly irregular (e.g. different ways to
# record the book creator) as if the information is either an
# aggregation or was created at different times.
@afs
afs / fix-fuseki-315.sh
Created May 20, 2020 16:54
Emergency fix for fuseki-server.jar in apache-jena-fuseki-3.15.0.zip
#!/bin/bash
# Replace file Log4j2Plugins.dat in fuseki-server.jar for the one
# in jena-fuseki-server.jar.
ROOT="https://repo1.maven.org/maven2/org/apache/jena"
VER=3.15.0
JAR="jena-fuseki-server-$VER.jar"
L4J="META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat"