By the way, I just notice that there is dash:DateTimePicker in the 
published DASH vocabulary

wtorek, 16 czerwca 2020 o 00:09:17 UTC+2 Holger Knublauch napisał(a):

>
> On 15/06/2020 19:59, Tomasz Pluskiewicz wrote:
>
> Ah, yes, I realise that I eventually implemented it similarly with the 
> default value because always added for new values so indeed the selection 
> process is the same for existing and new objects. 
>
> Could you link to a diff of what you changed in forms.html?
>
> Attached
>
> Holger
>
>
>
> W dniu poniedziałek, 15 czerwca 2020 02:23:31 UTC+2 użytkownik Holger 
> Knublauch napisał: 
>>
>> In our implementation each widget receives a "default" value when 
>> initialized. In the case of literals, this is a literal with the lexical 
>> form "", i.e. the empty string. In the case of URIs this is an URI node 
>> with "" as its URI. This approach means that these scoring rules can apply 
>> relatively consistently.
>>
>> Having said this, the score functions in our implementation also receive 
>> a second argument, which is metadata about the 'field', which is basically 
>> the collection of applicable property shapes for that property/path. Some 
>> widgets do use that metadata to make further choices in cases where the 
>> node isn't sufficient to make a decision.
>>
>> Examples:
>> BlankNodeViewer.score = (value, field) => {
>>     return value.isBlankNode() ? 1 : 0;
>> };
>>
>>
>> The only widgets that use the 'field' above are dash:Editors:
>> BooleanSelectEditor.score = (value, field) => {
>>     if(value.dt == 'boolean') {
>>         return 10;
>>     }
>>     if(field.isObjectProperty) {
>>         return 0;
>>     }
>>     if(field.hasDT('boolean')) {
>>         return 10;
>>     }
>>     if(field.hasAnyDT()) {
>>         return 0;
>>     }
>>     return null;
>> };
>>
>>
>> DatePickerEditor.score = (value, field) => {
>>     return value.dt == 'date' ? 10 : field && field.hasDT('date') ? 5 : 0
>> ;
>> };
>>
>> DateTimePickerEditor.score = (value, field) => {
>>     return value.dt == 'dateTime' ? 10 : field && field.hasDT('dateTime'
>> ) ? 5 : 0;
>> };
>>
>> EnumSelectEditor.score = (value, field) => {
>>     return field && field.enumValues ? 10 : 0;
>> };
>>
>> FromConceptSchemeEditor.score = (value, field) => {
>>     if(field && field.hasAnyDT()) {
>>         // Unsuitable for datatype fields
>>         return 0;
>>     }
>>     
>> // We don't have enough info here to decide so leave the choice to users
>>     return null;
>> };
>>
>> OWLManchesterSyntaxEditor.score = (value, field) => {
>>     if (
>>         !field.path.isInverse &&
>>         (field.path.predicate == '
>> http://www.w3.org/2000/01/rdf-schema#domain' ||
>>             field.path.predicate == '
>> http://www.w3.org/2000/01/rdf-schema#range' ||
>>             field.path.predicate == '
>> http://www.w3.org/2000/01/rdf-schema#subClassOf' ||
>>             field.path.predicate == '
>> http://www.w3.org/2002/07/owl#disjointWith' ||
>>             field.path.predicate == '
>> http://www.w3.org/2002/07/owl#equivalentClass')
>>     ) {
>>         if (value.isBlankNode()) {
>>             return 50;
>>         } else {
>>             return null;
>>         }
>>     } else {
>>         return 0;
>>     }
>> };
>>
>> TextAreaEditor.score = (value, field) => {
>>     if (value.isString()) {
>>         if (field && field.singleLine === true) {
>>             return 0;
>>         } else if (field && field.singleLine === false) {
>>             return 20; // Prefer over single line editors
>>         } else if(DisplayUtil.containsLineBreak(value.lex) && field.
>> singleLine !== false) {
>>             return 20; 
>> // Prefer over single line editors if line breaks exist
>>         } else {
>>             return 5;
>>         }
>>     } else if (field.hasDT('string')) {
>>         return 2;
>>     }
>>     else if(field.hasCustomDatatype()) {
>>         return null;
>>     } else {
>>         return 0;
>>     }
>> };
>>
>> TextAreaWithLangEditor.score = (value, field) => {
>>     if (value.isLangString() || (field && field.isStringOrLangString
>> ())) {
>>         if (field && field.singleLine === true) {
>>             return 0;
>>         } else if (field && field.singleLine === false) {
>>             return 15; // Prefer over single line editors
>>         } else if(DisplayUtil.containsLineBreak(value.lex) && field.
>> singleLine !== false) {
>>             return 15; 
>> // Prefer over single line editors if line breaks exist
>>         } else {
>>             return 5;
>>         }
>>     } else if (field && field.hasDT('langString') && !field.singleLine) {
>>         return 5;
>>     } else {
>>         return 0;
>>     }
>> };
>>
>> TextFieldWithLangEditor.score = (value, field) => {
>>     if (value.isLangString() || (field && field.isStringOrLangString
>> ())) {
>>         return 10;
>>     } else if (field && field.hasDT('langString') && !field.singleLine) {
>>         return 5;
>>     } else {
>>         return 0;
>>     }
>> };
>>
>> TimeEditor.score = (value, field) => {
>>     return value.dt == 'time' ? 15 : field && field.hasDT('time') ? 5 : 0
>> ;
>> };
>>
>> URIEditor.score = (value, field) => {
>>     if (value.isURI()) {
>>         if (field.nodeKind && field.nodeKind.label == 'IRI' && field.
>> isObjectProperty && field.classes.length == 0) {
>>             return 10;
>>         } else {
>>             return null;
>>         }
>>     } else {
>>         return 0;
>>     }
>> };
>>
>> I have made small updates to the forms.html online doc to clarify this 
>> (and added dash:DateTimePicker which we have implemented in the meantime).
>>
>> Holger
>>
>>
>> On 12/06/2020 18:51, Tomasz Pluskiewicz wrote:
>>
>> Hi 
>>
>> I am implementing a SHACL form builder in JavaScript and intended to have 
>> DASH integrated by default.
>>
>> I have a little difficulty with the scoring system. Let's take the 
>> simplest text field as example. The spec says
>>
>>
>>    - 10 if the value is a literal that is neither rdf:langString nor 
>>    xsd:boolean 
>>    - 0 otherwise 
>>
>> First question is in general about the rules which mention a "value". 
>> This applies only to existing triples in the dataset at the time the form 
>> is initialised, correct? For example
>>
>> # score 10
>> <#me> rdfs:label "Tomasz Pluskiewicz" .
>>
>> # score 0
>> <#me> rdfs:label "Tomasz Pluskiewicz"@pl .
>>
>> I think this is missing a rule for adding new objects for a property. 
>> Such as when a user clicks a (+) button. In that case the property shape is 
>> the only information available as there is no "value" yet. 
>> The example snippet does show a "sh:datatype xsd:string" but it's not 
>> mentioned in the score rules for the text field. A bit of a grey area?
>>
>> Best,
>> Tom
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "TopBraid Suite Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to topbrai...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/topbraid-users/14c15fa7-448a-4d00-9c9e-ca957e12f56co%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/topbraid-users/14c15fa7-448a-4d00-9c9e-ca957e12f56co%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> -- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to topbraid-user...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/topbraid-users/01450f1d-ed27-40a3-a10d-19b9b70b00bao%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/01450f1d-ed27-40a3-a10d-19b9b70b00bao%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/76b28c42-004b-4b65-9f4a-4a449655b011n%40googlegroups.com.

Reply via email to