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

Add API smwbrowse module #2696

Merged
merged 1 commit into from Sep 23, 2017

Conversation

Projects
None yet
2 participants
@mwjames
Copy link
Contributor

mwjames commented Sep 23, 2017

This PR is made in reference to: #

This PR addresses or contains:

  • Adds smwbrowse as API module (required for an upcoming feature) and currently supports the search for
    • properties
    • categories
    • concepts
  • Does a similar thing like browsebyproperty but that module was not easily extendable therefore rewrote it from scratch, eventually it will be deprecated and removed
  • It is expected to incorporate browsebysubject at a later state so that this module can be scrapped as well
  • Classes and responsibilities are split into:
    • Browse (API, MediaWiki)
    • ListLookup (primary selector),
    • ListAugmentor (adding additional field components) with
      • property to support:
        • description to pull the Has property description in a selected language
        • prefLabal to fetch the Has preferred property label in a selected language
        • usageCount retrieve the usage count of the property
    • LookupCache caches each request for 1 h (can be changed using smwgCacheUsage and api.browse) and by this avoids to introduce some complex invalidation strategy, yet keeping requests close to up-to-date information

Example

'api.php?action=smwbrowse&browse=property&params={ "limit": 10, "offset": 0, "search": "Date" }',
'api.php?action=smwbrowse&browse=property&params={ "limit": 10, "offset": 0, "search": "Date", "description": true }',
'api.php?action=smwbrowse&browse=property&params={ "limit": 10, "offset": 0, "search": "Date", "description": true, "prefLabel": true }',
'api.php?action=smwbrowse&browse=property&params={ "limit": 10, "offset": 0, "search": "Date", "description": true, "prefLabel": true, "usageCount": true }',
'api.php?action=smwbrowse&browse=category&params={ "limit": 10, "offset": 0 }',
'api.php?action=smwbrowse&browse=category&params={ "limit": 10, "offset": 0, "search": "Date" }',
'api.php?action=smwbrowse&browse=concept&params={ "limit": 10, "offset": 0 }'
'api.php?action=smwbrowse&browse=concept&params={ "limit": 10, "offset": 0, "search": "Date" }'

Output

{
    "query": {
        "Has_description": {
            "label": "Has description",
            "key": "Has_description",
            "description": {
                "en": "Simple descriptive explanatory text property."
            },
            "prefLabel": {
                "en": ""
            }
        },
        "_PDESC": {
            "label": "Has property description",
            "key": "_PDESC",
            "description": {
                "en": ""Has property description" is a predefined prop..."
            },
            "prefLabel": {
                "en": ""
            }
        }
    },
    "query-continue-offset": 0,
    "version": 1,
    "meta": {
        "type": "property",
        "limit": 10,
        "count": 2,
        "isFromCache": "",
        "queryTime": 0.00051
    }
}

This PR includes:

  • Tests (unit/integration)
  • CI build passed

Fixes #

@mwjames mwjames added this to the SMW 3.0.0 milestone Sep 23, 2017

@mwjames mwjames merged commit d3930bf into master Sep 23, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@mwjames mwjames deleted the api-smwbrowse branch Sep 23, 2017

@kghbln

This comment has been minimized.

Copy link
Member

kghbln commented Sep 24, 2017

@kghbln kghbln added enhancement and removed wikidocu missing labels Sep 24, 2017

mwjames added a commit that referenced this pull request Jul 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment