Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Arturo Montejo Ráez
/
solid2022
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b8b96013
authored
Apr 27, 2022
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
consulta con SPARQL
parent
43332ef2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
index.html
js/main.js
index.html
View file @
b8b96013
...
@@ -65,10 +65,12 @@
...
@@ -65,10 +65,12 @@
<h2>
Contactos
</h2>
<h2>
Contactos
</h2>
<ul
id=
"friends"
></ul>
<ul
id=
"friends"
></ul>
<input
id=
"newFriend"
size=
"60"
/>
<button
id=
"addFriend"
>
Añadir
</button>
<h2>
POD
</h2>
<h2>
POD
</h2>
<input
id=
"container"
size=
"60"
/>
<button
id=
"updateContainer"
>
Actualizar
</button>
<input
id=
"container"
size=
"60"
/>
<button
id=
"updateContainer"
>
Actualizar
</button>
<ul
id=
"items"
></ul>
<ul
id=
"items"
></ul>
<input
id=
"newContainer"
size=
"60"
/>
<button
id=
"addContainer"
>
Crear carpeta
</button>
</div>
</div>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"
></script>
<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>
<script
src=
"js/solid-auth-client.bundle.js"
></script>
...
...
js/main.js
View file @
b8b96013
...
@@ -100,3 +100,41 @@ async function showContainer(container) {
...
@@ -100,3 +100,41 @@ async function showContainer(container) {
$
(
'#items'
).
append
(
$
(
'<li>'
).
append
(
element
));
$
(
'#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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment