I'm using the following Neo4j Cypher query that I'd like to replace with
a SPARQL query against Wikidata:
MATCH (a:Item), (b:Item)
WHERE a.itemId IN ['Q2', 'Q405', 'Q525'] AND b.itemId IN ['Q2',
'Q405', 'Q525']
WITH a, b
OPTIONAL MATCH (a)-[rel]-(b)
RETURN a, b, collect(rel)
The objective is to return the relationships between a given set of
items. Here's the SPARQL query that I'm trying, but it times out:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX entity: <http://www.wikidata.org/entity/>
PREFIX p: <http://www.wikidata.org/prop/direct/>
SELECT ?subjectUrl ?subjectLabel ?propUrl ?propLabel ?objectUrl
?objectLabel
WHERE {
hint:Query hint:optimizer 'None' .
?subjectUrl ?propUrl ?objectUrl .
?subjectUrl rdfs:label ?subjectLabel .
?objectUrl rdfs:label ?objectLabel .
FILTER (LANG(?subjectLabel) = 'en') .
FILTER (LANG(?objectLabel) = 'en') .
?property ?ref ?propUrl .
?property a wikibase:Property .
?property rdfs:label ?propLabel
FILTER (lang(?propLabel) = 'en' ) .
FILTER (?subjectUrl IN (entity:Q2, entity:Q405, entity:Q525))
.
FILTER (?objectUrl IN (entity:Q2, entity:Q405, entity:Q525)) .
}
LIMIT 200
Is it feasible have a SPARQL query with this objective return in a few
seconds? If so, can you please give me some guidance on an approach?
Thanks,
James Weaver
I wrote my Bachelor's thesis on "Generating Article Placeholders from
Wikidata for Wikipedia: Increasing Access to Free and Open Knowledge". The
thesis summarizes a lot of the work done on the ArticlePlaceholder
extension ( https://www.mediawiki.org/wiki/Extension:ArticlePlaceholder )
I uploaded the thesis to commons under a CC-BY-SA license- you can find it
at
https://commons.wikimedia.org/wiki/File:Generating_Article_Placeholders_fro…
I continue working on the extension and aim to deploy it to the first
Wikipedias, that are interested, in the next months.
I am happy to answer questions related to the extension!
Lucie (Frimelle)
--
Lucie-Aimée Kaffee
Working Student Software Development
Wikimedia Deutschland e.V. | Tempelhofer Ufer 23-24 | 10963 Berlin
Phone: +49 (0)30 219 158 26-0http://wikimedia.de
Imagine a world in which every single human being can freely share in
the sum of all knowledge.
That‘s our commitment.
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e. V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg
unter der Nummer 23855 B.
Als gemeinnützig anerkannt durch das Finanzamt für Körperschaften I Berlin,
Steuernummer 27/029/42207.
Having the image statements populated in the Wikidata items would help
the performance of the http://ConceptMap.io application. I notice that
many of the Wikidata items have image statements, so I'm wondering if a
bot already exists that initializes these statements from the Wikipedia
article thumbnails. If so, I wonder if it could be run again. If one
doesn't exist, I'd be willing to write one with some guidance. I would
appreciate any thoughts that you have on this subject.
Thanks,
James Weaver
I have the following SPARQL query that returns the items related to Q42.
To avoid the compute time of making an additional query I would like to
tweak this query to return one additional row that contains the
information about Q42 itself using the same columns. Is there a special
property that indicates a self relationship, or any other way of
accomplishing the above in one query?
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX entity: <http://www.wikidata.org/entity/>
PREFIX p: <http://www.wikidata.org/prop/direct/>
SELECT ?propUrl ?propLabel ?valUrl ?valLabel ?picture
WHERE {
hint:Query hint:optimizer 'None' .
entity:Q42 ?propUrl ?valUrl .
?valUrl rdfs:label ?valLabel
FILTER (LANG(?valLabel) = 'en') .
?property ?ref ?propUrl .
?property a wikibase:Property .
?property rdfs:label ?propLabel
OPTIONAL{
?valUrl p:P18 ?picture .
}
FILTER (lang(?propLabel) = 'en' )
}
ORDER BY ?propUrl ?valUrl LIMIT 200
Please advise,
James Weaver
Hi!
We are committing a patch that implements a change in RDF format output,
specifically how we output coordinates as WKT points.
If you do not use RDF format exports and specifically WKT coordinate
literals there, this change has no effect for you.
When we first implemented it, we chose to make it "Point(latitude
longitude)". Unfortunately, turns out the standard way in WKT is
Point(longitude latitude) and that's how most of the tools that
implement WKT format understand it. In general, geo-data formats are
split on this question, see http://www.macwright.org/lonlat/. But WKT is
pretty universally in lon-lat camp, so we have to follow the established
practice.
As such, we are changing the WKT representation and we are bumping the
format version (reported as schema:softwareVersion on RDF dumps/exports)
from 0.0.1 to 0.0.2 so that the tools could adjust properly.
See more details in: https://phabricator.wikimedia.org/T130049
Thanks,
--
Stas Malyshev
smalyshev(a)wikimedia.org
Hello all,
The Photographers' Identities Catalog (PIC) is an ongoing project of
visualizing photo history through the lives of photographers and photo
studios. I have information on 115,000 photographers and studios as of
tonight. It is still under construction, but as I've almost completed an
initial indexing of the ~12,000 photographers in WikiData, I thought I'd
share it with you. We (the New York Public Library) hope to launch it
officially in mid to late January. This represents about 12 years worth of
my work of researching in NYPL's photography collection, censuses and
business directories, and scraping or indexing trusted websites, databases,
and published biographical dictionaries pertaining to photo history.
Again, please bear in mind that our programmer is still hard at work (and I
continue to refine and add to the data*), but we welcome your feedback,
questions, critiques, etc. To see the WikiData photographers, select
WikiData from the Source dropdown. Have fun!
*PIC*
<http://mgiraldo.github.io/pic/?address.AddressTypeID=*&address.CountryID=*&…>
Thanks,
David
*Tomorrow, for instance, I'll start mining Wikidata for birth & death
locations.
Hi all!
I would like to present to you a preview of an upcoming Wikidata Query
Service feature, namely geospatial search - on
http://geotest.wmflabs.org/. With this, you will be able to search
things by their geographic coordinates, e.g.:
Objects within 10km of Paris:
http://tinyurl.com/jaxr3bn
Airports within 100km from Berlin:
http://tinyurl.com/gtbmqz3
(try also the map view!)
The purpose of the preview is to let people play with it and collect
feedback on what works, what doesn't and what you'd like to see
added/changed/removed.
This is a preview implementation, so do not use it for anything beyond
admiring the marvels of modern technology :) and providing feedback. The
full release on query.wikidata.org will follow sometime in late
April-early May, hopefully.
What is implemented?
- Coordinate storage & indexing as WKT literals
- Search within radius and within bounding box
- Support for different globes
What is missing but would be added soon?
- Distances as search output and as separate function
- Documentation
- You tell me
Thanks,
--
Stas Malyshev
smalyshev(a)wikimedia.org