11# ' @keywords internal
2- validate_create_entity_args <- function (label ,
3- description ,
4- language ,
5- wikibase_api_url ,
6- equivalence_property ,
7- equivalence_id ,
8- classification_property ,
9- classification_id ,
10- csrf ,
11- data_curator ,
12- validated_action ) {
2+ validate_create_entity_args <- function (
3+ label ,
4+ description ,
5+ language ,
6+ wikibase_api_url ,
7+ equivalence_property ,
8+ equivalence_id ,
9+ classification_property ,
10+ classification_id ,
11+ csrf ,
12+ data_curator ,
13+ validated_action ) {
1314
1415 if (! is.character(validated_action ) || length(validated_action ) != 1 || nchar(validated_action )== 0 ) {
1516 stop(" validate_copy_entity_args(..., validated_action) : 'validated_action' must be a non-empty character string." )
1617 }
1718
1819
19- if (is.na(label ) || ! is.character(label ) || length(label ) != 1 || nchar(label ) == 0 ) {
20+ if (is.na(label ) || ! is.character(label ) ||
21+ length(label ) != 1 || nchar(label ) == 0 ) {
2022 stop(validated_action , " : 'label' must be a non-empty character string." )
2123 }
2224
23- if (any(is.na(language )) || ! any(is.character(language )) || length(language ) < 1 || any(nchar(language ))< 0 ) {
25+ if (any(is.na(language )) || ! any(is.character(language )) ||
26+ length(language ) < 1 || any(nchar(language ))< 0 ) {
2427 stop(validated_action , " : 'language' must be a non-empty character vector." )
2528 }
2629
@@ -30,33 +33,40 @@ validate_create_entity_args <- function(label,
3033 stop(validated_action , " : 'wikibase_api_url' must be a valid URL." )
3134 }
3235
33- if (! is.character(equivalence_property ) || length(equivalence_property ) != 1 ) {
36+ if (! is.character(equivalence_property ) ||
37+ length(equivalence_property ) != 1 ) {
3438 stop(validated_action , " : 'equivalence_property' must be a non-empty character string." )
3539 }
3640
37- if (! is.character(classification_property ) || length(classification_property ) != 1 ) {
41+ if (! is.character(classification_property ) ||
42+ length(classification_property ) != 1 ) {
3843 stop(validated_action , " : 'classification_property' must be a non-empty character string." )
3944 }
4045
4146
42- if (! is.null(description ) && (! is.character(description ) || length(description ) != 1 )) {
47+ if (! is.null(description ) && (! is.character(description )
48+ || length(description ) != 1 )) {
4349 stop(validated_action , " : 'description' must be a character string or NULL." )
4450 }
4551
46- if (! is.null(data_curator ) && ! inherits(data_curator , " person" )) {
52+ if (! is.null(data_curator ) &&
53+ ! inherits(data_curator , " person" )) {
4754 stop(validated_action , " : 'data_curator' must be a person() object." )
4855 }
4956
50- if (! is.na(equivalence_id ) && is.na(equivalence_property )) {
57+ if (! is.na(equivalence_id ) &&
58+ is.na(equivalence_property )) {
5159 stop(validated_action , " : Cannot provide an 'equivalence_id' without an 'equivalence_property'." )
5260 }
5361
5462 # Optionally: validate classification logic
55- if (! is.na(classification_property ) && is.na(classification_id )) {
63+ if (! is.na(classification_property ) &&
64+ is.na(classification_id )) {
5665 stop(validated_action , " : classification_property provided without classification_id." )
5766 }
5867
59- if (! is.na(classification_id ) && is.na(classification_property )) {
68+ if (! is.na(classification_id ) &&
69+ is.na(classification_property )) {
6070 stop(validated_action , " : classification_id provided without classification_property." )
6171 }
6272
0 commit comments