SemanticMediaWiki / SemanticCite

Allows to manage citation resources using semantic annotations
https://www.semantic-mediawiki.org/wiki/Extension:Semantic_Cite
Other
24 stars 13 forks source link

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

Open amglez opened 4 years ago

amglez commented 4 years ago

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 commented 3 years ago

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

kghbln commented 3 years ago

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 commented 3 years ago

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.

rubenvandeven commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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

rubenvandeven commented 2 years ago

@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 commented 2 years ago

@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.