Open jeff-zucker opened 2 years ago
A DataSource is used by the Autocomplete Field to pull in possible instances of things as the user types in the name of the thing, like a Language, or an Organization, or a Occupation, and so on.
For example
:WikidataLanguageField a ui:AutocompleteField;
ui:label "Language"; ui:size 30;
ui:property solid:publicId; # @@
ui:dataSource :WikidataLanguageDataSource;
ui:targetClass schema:Language .
:WikidataLanguageDataSource
schema:name "Wikidata languages";
ui:endpoint "https://query.wikidata.org/sparql" ;
ui:objectURIBase <https://www.w3.org/ns/iana/language-code/>;
# Add this to any literal string returned as ?subject
ui:searchByNameQuery """SELECT ?item ?subject ?name
WHERE
{ ?item wdt:P305 ?subject .
OPTIONAL {?item rdfs:label ?name}
OPTIONAL {?item wdt:P1705 ?name}
FILTER regex(?name, "$(name)", "i")
FILTER regex(?subject, "^..$", "i")
}""" .
There is a convention that the query template must have specific variables subject
, item
, and name
Other than me using ui:query and the autocomplete using ui:searchByNameQuery, my propoesed ui:SparqlQuery as a sub-class of ui:DataSource seems compatible with the autocomplete.
By extending the DataSource to include other things than SPARQL queries, we can create auto-completes from a turtle file or hard-coded data or results of a script.
another example:
:escoSkillField a ui:AutocompleteField;
ui:label "skill"; ui:size 30;
ui:property solid:publicId;
ui:dataSource :ESCO_Skill_DataSource;
ui:targetClass schema:Skill .
:ESCO_Skill_DataSource a ui:DataSource;
schema:name "ESCO Skill";
ui:targetClass esco:Skill ;
schema:logo <https://ec.europa.eu/esco/portal/static_resource2/images/logo/logo_en.gif>;
ui:searchByNameURI "https://ec.europa.eu/esco/api/search?language=$(language)&limit=$(limit)&type=skill&text=$(name)".
"Other than me using ui:query and the autocomplete using ui:searchByNameQuery, my proposed ui:SparqlQuery as a sub-class of ui:DataSource seems compatible with the autocomplete." - yes. The ui:searchByNameURI
is a non-sparql. example. Yes, using a local data table could be a DataSource too.
Great, glad we are thinking along the same lines about DataSource. It isn't AFAIK in the ontology. Do you have a definition for it somewhere or should I create one along the lines of what we've said above? If I should create it, any hints appreciated :-).
Components are expressed in this form :
The
ui:Component
is a possibly interactive UI feature that includes subclasses such asui:Menu
,ui:Table
, etc. Each component can be linked to aui:DataSource
. Some components require specific DataSources, others can use any DataSource. Those relationships will be described in the section of the ontology dealing withui:Component
.ui:DataSource
A ui:DataSource is anything that can be used to retrieve data including :
DataSource is an rdf:Collection
DataSource is a ui:SparqlQuery
DataSource is an RDF subject
DataSource is a ui:Link
DataSource is a ui:HardCoded