مساعدة:بوابة محددات الخواص/صيغة

This page is a translated version of the page Help:Property constraints portal/Format and the translation is 56% complete.
Outdated translations are marked like this.

يحدد format constraint (Q21502404) أن القيم لخاصية ينبغي أن تتوافق مع نمط معين.

على سبيل المثال، قيمة GNIS Feature ID (P590) ينبغي أن تكون دائمًا عددًا مع ما يصل إلى ثمانية أرقام، دون أصفار البادئة: [1-9][0-9]{0,7}.

النمط تعبير نمطي، لكن الصفة المميزة تختلف: KrBot، الذي يقوم بإنشاء تقارير قاعدة البيانات، يستخدم PCRE، امتداد قيود جودة قاعدة الويكي، الذي يشغل Special:ConstraintReport والأداة، يستخدم خدمة استعلام ويكي بيانات، والتي تستخدم حاليا java.util.regex، ولكن قد يتغير إلى تعبيرات XQuery 1.0 / XPath 2.0 النمطية كما هو محدد بواسطة سباركل إذا نفذت BlazeGraph الدعم لها، الصفات المميزة في الغالب، ولكنها غير متوافقة تماما، للتوافق مع كل من محركات القيد، تلتزم بمجموعة فرعية مشتركة من الصفات المميزة.

إذا لم يتم تحديد constraint scope (P4680)، يتم فحص هذا القيد في كل مكان.

الإجراءات الممكنة

هناك العديد من السبل الممكنة للتصدي لانتهاك هذا القيد:

  • تتمثل الحالة الأكثر ترجيحا في أن القيمة مشوهة بطريقة ما، غالبا ما يكون الإصلاح صريحا: أضف بادئة مفقودة أو أزل البادئة التي يجب أن تكون ضمنية، وأضف علامات ترقيم (على سبيل المثال، إضافة واصلات إلى رقم رقم دولي معياري للكتاب)، واضبط الأحرف الكبيرة، وما إلى ذلك.
  • من الممكن أن تكون القيمة صحيحة، ولكنها لا تنتمي إلى هذه الخاصية، وأنه يجب نقلها إلى بيان لخاصية مختلفة (مثل ISBN-13 (P212) إلى ISBN-10 (P957)).
  • من الممكن أن يكون المعرف قد وُسِّع نطاقه ويجب تعديل الترجمات المعتادة (على سبيل المثال، يستخدم المعرف الآن ما يصل إلى 15 رقما وليس 10 كما هو الحال عندما تم تعريفه لأول مرة).
  • من الممكن أن يكون هذا البند استثناء نادرا لكن شرعيا للقيود، ولا يجب فعل أي شيء.

وسائط

هذا القيد لديه وسيط إلزامي واحد:

format as a regular expression (P1793)
تحتوي على صيغة/نمط. يجب أن تحتوي على قيمة واحدة بالضبط (غير مسموح بno value Help أو unknown value Help)، الذي يجب أن يكون تعبيرًا نمطيًا صالحًا.
syntax clarification (P2916)
يحتوي على وصف قابل للقراءة من قبل البشر للنمط، يمكن تحديده عدة مرات بلغات مختلفة.

Examples

Example 1

Values for image (P18) should end with certain file extension like .jpg or .png.

property constraint
  format constraint
format as a regular expression (?i).+\.(jpg|jpeg|png|svg|tif|tiff|gif|xcf)
0 reference
add reference


add value

Example 2

Using syntax clarification (P2916) parameter for explaining the regular expression in human-readable text. For example, value of IPA transcription (P898) doesn't contain : (colon) or ' (apostrophe). Correct character is ː (length) or ˈ (stress). This regular expression is difficult to understand without explanation.

property constraint
  format constraint
format as a regular expression [^:]+
syntax clarification colon is not a valid IPA character, the correct character for a length mark is ː (English)
0 reference
add reference
  format constraint
format as a regular expression [^']+
syntax clarification apostrophe is not a valid IPA character, the correct character for primary stress is ˈ (English)
0 reference
add reference


add value

Template

When the constraint is set to the property, the following template is automatically displayed in the property talk page. The template is created by Module:Constraints using Template:Constraint, invoked from Template:Property documentation. Translations are defined at Module:i18n/constraints.

Format “(?i).+\.(jpg|jpeg|jpe|png|svg|tif|tiff|gif|xcf|pdf|djvu|webp)|: value must be formatted using this pattern (PCRE syntax). (Help)
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P18#Format, SPARQL

Lists

Lists of properties which are set format constraint.