G
by gabriel_makedrive on 11 Jun 2024, edited 7 Aug 2024
#
I'm trying to develop an IDS file and analyze it through a python program to check if there is a certain property and if it has a value different from a predefined value. The best way I found for this was to evaluate whether the property exists with a value in the regex pattern '(?!Nenhum).+', which would be any value other than 'Nenhum'
The property of my IDS file that analize that:
` <ids:property dataType="IFCTEXT" cardinality="required">
<ids:propertySet>
<ids:simpleValue>Circuito</ids:simpleValue>
</ids:propertySet>
<ids:baseName>
<ids:simpleValue>Circuito_*</ids:simpleValue>
</ids:baseName>
<ids:value>
<xs:restriction base="xs:string">
<xs:pattern value="(?!Nenhum).+" />
</xs:restriction>
</ids:value>
</ids:property>`
When i use the function validate with this IDS it gives an error "RegexError: invalid '(?...)' extension notation at position 0: '(?!Nenhum).+' "
What are the best practices for this situation?
B
by Bimlooser on 11 Jun 2024
#
I don't understand completely but maybe this https://github.com/buildingSMART/IDS/blob/development/Documentation/restrictions.md can be useful
G
by gabriel_makedrive on 12 Jun 2024
#
Yes, thanks, that explains a few things, my case would be a complex restrictions with pattern and because of limitations of the XML Regular expressions for IDS its not possible use negative lookahead. So apparently it is really not possible with IDS to check if a property is not a predefined value.
B
by Bimlooser on 12 Jun 2024
#
Maybe try this

any number of characters (including zero characters) can occur before or after the text "Nenhum".
G
by gabriel_makedrive on 6 Aug 2024, edited 6 Aug 2024
#
My solution that worked:
Negative lookahead its realy not possible for regular expressions in IDS, the negative, that specify that should not have something with some text, should be in the applicability as a ' maxOccurs="0" ', the requirements go empty. That is working for me to verify if a IFC file have a property with a error value and this allows the system to notify the designer to review these elements
The final IDS file specification look like this:
`
<ids:specification ifcVersion="IFC4" name="SEM CIRCUITO">
<ids:applicability minOccurs="0" maxOccurs="0">
<ids:property dataType="IFCTEXT">
<ids:propertySet>
<ids:simpleValue>Circuito</ids:simpleValue>
</ids:propertySet>
<ids:baseName>
<xs:restriction base="xs:string">
<xs:pattern value=".*Circuito.*" />
</xs:restriction>
</ids:baseName>
<ids:value>
<ids:simpleValue>Nenhum</ids:simpleValue>
</ids:value>
</ids:property>
</ids:applicability>
<ids:requirements />
</ids:specification>
`
M
by Moult on 6 Aug 2024
#
Indeed this is known as a prohibited specification.
G
by gabriel_makedrive on 7 Aug 2024
#
@Moult said:
Indeed this is known as a prohibited specification.
There's an allowed alternative to this case?