-
Notifications
You must be signed in to change notification settings - Fork 32
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
Jiemingy project 4 draft #86
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only 38 points?
Project 4/README.md
Outdated
?item wdt:P31 wd:Q5. #instance of human. | ||
?item wdt:P27 wd:Q148. # a citizen of PR of China. | ||
?item wdt:P106 wd:Q82955. # politician. | ||
{?item wdt:P22 ?father. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the VALUES keyword instead of UNION here. UNION increases the computational complexity of the query significantly, VALUES doesn't.
Otherwise, I'm liking this kata :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi John,
Can VALUES keywords work for predicate? I plan to make the object as constant, such as wd:Q82955, and the predicate a variable. For example, ?item ?relation wd:Q82955 #as politician, and then use VALUES keywords for ?relation, qualifying the relations by father, mother, spouse, etc. But I tried, and it does not work.
Bests,
Jieming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jiemingy Yep! For example, instead of:
UNION {?item wdt:P25 ?mother.
?mother wdt:P106 wd:Q82955.}
UNION {?item wdt:P8810 ?parent.
?parent wdt:P106 wd:Q82955.}
You can write:
VALUES ?predicate (wdt:P25 wdt:P8810)
SELECT...WHERE...
?item ?predicate ?momordad .
?momordad wdt:P106 wd:Q82955.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Thank you!
_Jieming
Project 4/README.md
Outdated
FILTER (?dob >= "1949-10-01"^^xsd:dateTime). # item is borned later than Jan.1, 1949. | ||
|
||
|
||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], zh". } # Helps get the label in your language, if not, then zh language |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Folks now recommend not to use "zh" alone, but instead specify the region or dialect, etc. See here: https://www.w3.org/International/articles/language-tags/
Project 4/README.md
Outdated
?item wdt:P31 wd:Q613142. #item is an instance of law firm. | ||
?item wdt:P17 wd:Q30. #item is a US company. | ||
|
||
FILTER (!{?item wdt:P31 wd:Q163740.} UNION {?item wdt:P31 wd:Q613142}). #exclude an institute which is both a law firm and a nonprofit orginzation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why "!" rather than "FILTER NOT EXISTS"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi John,
Thank you for the good idea! I didn't think about that.
Bests,
Jieming
|
||
FILTER (!{?item wdt:P31 wd:Q163740.} UNION {?item wdt:P31 wd:Q613142}). #exclude an institute which is both a law firm and a nonprofit orginzation. | ||
|
||
OPTIONAL { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These OPTIONAL clauses operate as conditionals. So this should read more like "if the city is in the law firm's headquarter location"
Hi John, Thank you very much for the comments! I will work on the revision. Bests, |
Dear John,
This is my submission of project 4.
Bests,
Jieming