consulta con SPARQL

parent 43332ef2
Showing with 41 additions and 0 deletions
......@@ -65,10 +65,12 @@
<h2>Contactos</h2>
<ul id="friends"></ul>
<input id="newFriend" size="60"/> <button id="addFriend">Añadir</button>
<h2>POD</h2>
<input id="container" size="60" /> <button id="updateContainer">Actualizar</button>
<ul id="items"></ul>
<input id="newContainer" size="60"/> <button id="addContainer">Crear carpeta</button>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="js/solid-auth-client.bundle.js"></script>
......
......@@ -100,3 +100,41 @@ async function showContainer(container) {
$('#items').append($('<li>').append(element));
});
}
/* --------------------------------------------------
Añadimos una nueva carpeta (contenedor)
*/
$('#addContainer').click(async function () {
await fetcher.createContainer($('#container').val(), $('#newContainer').val(), null);
$('#newContainer').val('');
showContainer($('#container').val());
});
/* -----------------------------------------------
* Añadimos un nuevo amigo
*/
$('#addFriend').click(async function () {
person = store.sym($('#webid').val()); // nodos
friend = store.sym($('#newFriend').val());
profile = person.doc(); // este es el documento a actualizar (card)
store.add(person, FOAF('knows'), friend, profile);
await fetcher.putBack(profile); // actualizamos documento en la nube
$('#newFriend').val('');
showFriends(person);
});
/*
Para probar en la consola
query_sparql = "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
SELECT ?who WHERE { \
?who foaf:knows <" . $(#webid).val() . " > . \
}";
query = $rdf.SPARQLToQuery(query_sparql, false, store);
store.query(query, function (bindings) {
console.log(bindings['?who'].value);
});
*/
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment