Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
# Common files for RDF specifications

This repository is meant to be used as a submodule in multiple repository holding RDF and SPARQL specifications.

## Retrieving group participants

The `participants.js` Node script can be used to retrieve the list of working group participants. It requires an API Key.

node participants.js <apikey> wg/rdf-star > participantes.html
1 change: 1 addition & 0 deletions participants.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Members of the RDF-star Working Group Group included Adrian Gschwend, Andy Seaborne, Antoine Zimmermann, Dan Brickley, David Chaves-Fraga, Dominik Tomaszuk, Dörthe Arndt, Enrico Franconi, Fabien Gandon, Gregg Kellogg, Gregory Williams, Jesse Wright, Julián Arenas-Guerrero, Olaf Hartig, Ora Lassila, Pasquale Lisena, Peter Patel-Schneider, Pierre-Antoine Champin, Raphaël Troncy, Ruben Taelman, Rémi Ceres, Sarven Capadisli, Souripriya Das, Ted Thibodeau, and Timothée HAUDEBOURG.
74 changes: 74 additions & 0 deletions participants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Retrieve the list of users for a working group as a sentence.
// APIKEY and GROUP can be specified via either enironment variable or argument
// usage:
// APIKEY=<apikey> GROUP=wg/rdf-star node participants.js
// or
// node participants.js <apikey> wg/rdf-star
// group defaults to wg/rdf-star


const https = require('https');
const process = require('process');

const APIKEY = process.env.APIKEY || process.argv[2];
const GROUP = process.env.GROUP || process.argv[3] || "wg/rdf-star";

if (!APIKEY || !GROUP) {
console.error('Error: APIKEY and GROUP must be specified as either environment variables or command-line arguments.');
process.exit(1);
}

const groupOptions = {
hostname: 'api.w3.org',
path: `/groups/${GROUP}?items=50&apikey=${APIKEY}`,
headers: {
'Accept': 'application/json'
}
};

const userOptions = {
hostname: 'api.w3.org',
path: `/groups/${GROUP}/users?items=50&apikey=${APIKEY}`,
headers: {
'Accept': 'application/json'
}
};

https.get(groupOptions, (res) => {
let groupData = '';
let userData = '';

res.on('data', (chunk) => {
groupData += chunk;
});

res.on('end', () => {
const groupName = JSON.parse(groupData).name;

https.get(userOptions, (res) => {

res.on('data', (chunk) => {
userData += chunk;
});

res.on('end', () => {
const users = JSON.parse(userData)._links.users.map(u => u.title);
const sortedUsers = users.sort();

if (sortedUsers.length === 1) {
console.log(`The sole member of the ${groupName} Group was ${sortedUsers[0]}.`);
} else if (sortedUsers.length === 2) {
const joinedUsers = sortedUsers.join(' and ');
console.log(`Members of the ${groupName} Group included ${joinedUsers}.`);
} else {
const joinedUsers = sortedUsers.slice(0, -1).join(', ');
console.log(`Members of the ${groupName} Group included ${joinedUsers}, and ${sortedUsers[sortedUsers.length - 1]}.`);
}
});
}).on('error', (err) => {
console.error(`Error: ${err.message}`);
});
});
}).on('error', (err) => {
console.error(`Error: ${err.message}`);
});