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

/service/kb/concept/ endpoint not returning raw names #102

Closed
syats opened this issue May 19, 2020 · 2 comments
Closed

/service/kb/concept/ endpoint not returning raw names #102

syats opened this issue May 19, 2020 · 2 comments

Comments

@syats
Copy link

syats commented May 19, 2020

The following query:

curl --request GET 'http://localhost:8090/service/kb/concept/Q1221156?lang=de'

Returns

{
    "rawName": "Invalid id or excluded via caching",
    "preferredTerm": "Invalid id or excluded via caching",
    "nerd_score": 0,
    "nerd_selection_score": 0,
    "wikipediaExternalRef": 217450,
    "wikidataId": "Q1221156",
    "statements": [
        {
            "conceptId": "Q1221156",
            "propertyId": "P279",
            "propertyName": "subclass of",
            "valueType": "wikibase-item",
            "value": "Q107390",
            "valueName": "Invalid id or excluded via caching"
        },
        {
            "conceptId": "Q1221156",
            "propertyId": "P279",
            "propertyName": "subclass of",
            "valueType": "wikibase-item",
            "value": "Q387917",
            "valueName": "Invalid id or excluded via caching"
        },
        {
            "conceptId": "Q1221156",
            "propertyId": "P279",
            "propertyName": "subclass of",
            "valueType": "wikibase-item",
            "value": "Q406957",
            "valueName": "Invalid id or excluded via caching"
        },
        {
            "conceptId": "Q1221156",
            "propertyId": "P279",
            "propertyName": "subclass of",
            "valueType": "wikibase-item",
            "value": "Q10864048"
        },
        {
            "conceptId": "Q1221156",
            "propertyId": "P373",
            "propertyName": "Commons category",
            "valueType": "string",
            "value": "States of Germany"
        },
        {
            "conceptId": "Q1221156",
            "propertyId": "P17",
            "propertyName": "country",
            "valueType": "wikibase-item",
            "value": "Q183",
            "valueName": "Invalid id or excluded via caching"
        },
        {
            "conceptId": "Q1221156",
            "propertyId": "P910",
            "propertyName": "topic's main category",
            "valueType": "wikibase-item",
            "value": "Q6782598",
            "valueName": "Invalid id or excluded via caching"
        },
        {
            "conceptId": "Q1221156",
            "propertyId": "P646",
            "propertyName": "Freebase ID",
            "valueType": "external-id",
            "value": "/m/01fv5t"
        },
        {
            "conceptId": "Q1221156",
            "propertyId": "P227",
            "propertyName": "GND ID",
            "valueType": "external-id",
            "value": "4034013-2"
        }
    ]
}

Where rawName and preferredTerm are showing Invalid id or excluded via caching
Files in the DB are: db-de.zip and db-kb.zip The response seems unaffected by the value of the lang parameter. There is no output from Jetty server (at least not with the default logging level). This behaviour is only observed for entities (Ids starting with Q), and works as expected for properties (IDs starting with P).

Please advise.

@kermitt2
Copy link
Owner

kermitt2 commented May 19, 2020

You need the English wikipedia also installed, so the file db-en.zip, because the concept information at the language level default to the English Wikipedia (so all the plain text values not in WikiData as such). Note that the parameter lang=de is ignored when querying concept, it only matters when querying page id.

Then you should get the right text values:

curl --request GET 'http://cloud.science-miner.com/nerd/service/kb/concept/Q1221156'

{
	"rawName": "States of Germany",
	"preferredTerm": "States of Germany",
	"nerd_score": 0,
	"nerd_selection_score": 0,
	"wikipediaExternalRef": 217450,
	"wikidataId": "Q1221156",
	"definitions": [{
		"definition": "[[Germany]] is a [[federal republic]] consisting of sixteen '''states''' (, plural ''''; informally also '''', plural ''''). Since today's Germany was formed from an earlier collection of several states, it has a federal constitution, and the constituent states retain a measure of sovereignty. With an emphasis on geographical conditions, [[Berlin]] and [[Hamburg]] are frequently called '''' ([[city-state]]), as is the [[Bremen (state)|Free Hanseatic City of Bremen]], which in fact includes the cities of and . The remaining 13 states are called '''' (literally: ‘area states’).",
		"source": "wikipedia-en",
		"lang": "en"
	}],
	"domains": ["Geography"],
	"categories": [{
		"source": "wikipedia-en",
		"category": "States of Germany",
		"page_id": 747867
	}, {
		"source": "wikipedia-en",
		"category": "Subdivisions of Germany",
		"page_id": 1980904
	}, {
		"source": "wikipedia-en",
		"category": "Lists of country subdivisions",
		"page_id": 7582582
	}, {
		"source": "wikipedia-en",
		"category": "Country subdivisions of Europe",
		"page_id": 7582698
	}, {
		"source": "wikipedia-en",
		"category": "First-level administrative country subdivisions",
		"page_id": 8420344
	}, {
		"source": "wikipedia-en",
		"category": "States of Germany-related lists",
		"page_id": 37054470
	}, {
		"source": "wikipedia-en",
		"category": "Germany geography-related lists",
		"page_id": 37055863
	}],
	"multilingual": [{
		"lang": "de",
		"term": "Land (Deutschland)",
		"page_id": 254748
	}, {
		"lang": "es",
		"term": "Estado federado (Alemania)",
		"page_id": 5021311
	}, {
		"lang": "fr",
		"term": "Land (Allemagne)",
		"page_id": 12566
	}, {
		"lang": "it",
		"term": "Stati federati della Germania",
		"page_id": 15833
	}],
	"statements": [{
		"conceptId": "Q1221156",
		"propertyId": "P279",
		"propertyName": "subclass of",
		"valueType": "wikibase-item",
		"value": "Q107390",
		"valueName": "Federated state"
	}, {
		"conceptId": "Q1221156",
		"propertyId": "P279",
		"propertyName": "subclass of",
		"valueType": "wikibase-item",
		"value": "Q387917",
		"valueName": "Administrative divisions of Germany"
	}, {
		"conceptId": "Q1221156",
		"propertyId": "P279",
		"propertyName": "subclass of",
		"valueType": "wikibase-item",
		"value": "Q406957",
		"valueName": "First-level NUTS of the European Union"
	}, {
		"conceptId": "Q1221156",
		"propertyId": "P279",
		"propertyName": "subclass of",
		"valueType": "wikibase-item",
		"value": "Q10864048"
	}, {
		"conceptId": "Q1221156",
		"propertyId": "P373",
		"propertyName": "Commons category",
		"valueType": "string",
		"value": "States of Germany"
	}, {
		"conceptId": "Q1221156",
		"propertyId": "P17",
		"propertyName": "country",
		"valueType": "wikibase-item",
		"value": "Q183",
		"valueName": "Germany"
	}, {
		"conceptId": "Q1221156",
		"propertyId": "P910",
		"propertyName": "topic's main category",
		"valueType": "wikibase-item",
		"value": "Q6782598",
		"valueName": "States of Germany"
	}, {
		"conceptId": "Q1221156",
		"propertyId": "P646",
		"propertyName": "Freebase ID",
		"valueType": "external-id",
		"value": "/m/01fv5t"
	}, {
		"conceptId": "Q1221156",
		"propertyId": "P227",
		"propertyName": "GND ID",
		"valueType": "external-id",
		"value": "4034013-2"
	}]
}

@syats
Copy link
Author

syats commented May 20, 2020

Thanks, I can confirm that it works as expected with the db-en.zip file also there.

@syats syats closed this as completed May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants