Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use #ask to query data stored via Semantic Cite? #99

Open
amglez opened this issue Nov 23, 2020 · 9 comments
Open

How to use #ask to query data stored via Semantic Cite? #99

amglez opened this issue Nov 23, 2020 · 9 comments
Labels

Comments

@amglez
Copy link

amglez commented Nov 23, 2020

Question ¿enhacement?

I would like to be able to include in the text the reference, something like:
The book Blabla, A. (2010) "foo bla whatever" is so important ...
Could I do that with an ask?
thanx

@kghbln
Copy link
Member

kghbln commented Nov 24, 2020

You should I believe. Have a look at https://github.com/SemanticMediaWiki/SemanticCite/blob/master/docs/02-property-mapping.md

@kghbln
Copy link
Member

kghbln commented Nov 24, 2020

Live example:

Setting this up takes a bit of time but once you have done so ... Basically you query the subobject which is holding the data. From the result you can build the display of results as with every other query.

@kghbln
Copy link
Member

kghbln commented Nov 24, 2020

A more primitive example: https://sandbox.semantic-mediawiki.org/wiki/Gilbert%E2%80%99s_Dragon_Resources_query

Here you have to think of good citation key naming to be able to query for specific citations only.

@kghbln kghbln changed the title ask with semanticCite How to using #ask to query data stored via Semantic Cite? Nov 25, 2020
@kghbln kghbln changed the title How to using #ask to query data stored via Semantic Cite? How to use #ask to query data stored via Semantic Cite? Nov 25, 2020
@rubenvandeven
Copy link

I would like to do something slightly different, and it does not seem to work as I had expected:

When I run an #ask query for pages, I would like to show/join properties from the CiteRef'ed references. Yet for some reason the fields stay empty.
I have created an Example Ask statement based on the pages in this thread, indicating how I try run the query.

Should I use a different query or is this not supported for now?

Many thanks!

@kghbln
Copy link
Member

kghbln commented Oct 2, 2021

I created the following example which may get you what you are seeing for: Citable resources stored In the end it depends on the data stored for the resource.

If you decoupled storage of metadata and usage of metadata you will indeed not get the pages. Probably reusing the results for a second query with a template gets the connection. Have not tried this yet.

@rubenvandeven
Copy link

Thanks for the example! As you suspected, I indeed have them decoupled as we use a single page on which we import our Zotero library.
Ideally, I would export these relations using an #ask straight to JSON, but as I understand it, that doesn't seem possible for now. Perhaps the suggestion with a template would work as an intermediate solution. Thanks!

@WolfgangFahl
Copy link

@rubenvandeven you might want to try https://pypi.org/project/py-3rdparty-mediawiki/ 's wikiquery command line to get your json.

@rubenvandeven
Copy link

@WolfgangFahl Thanks for the suggestion. It seems like a convenient tool to export an ask to a json from cli.

For now I worked around the issue by running a bot over all pages and adding an additional [[Cited reference]] property that links to the SemanticCite subobject.

In case this is useful to anyone, the code can be found here.

@WolfgangFahl
Copy link

@rubenvandeven - that bot looks interesting. It might be much shorter if you'd use the https://pypi.org/project/py-3rdparty-mediawiki/ and https://pypi.org/project/wikirender/ libraries. Together with https://pypi.org/project/pylodstorage/ and https://github.com/WolfgangFahl/pyOnlineSpreadSheetEditing a whole word of options might be opened up for you. I am also interested in your work for for my research and would love to get in touch with you personally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants