Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / FuFunctionEx.java
Last active August 2, 2024 13:33
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 / 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 / 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 / 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 / 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>