Comments (9)
Indeed it seems to be possible, see https://www.w3.org/TR/2011/CR-xmlschema11-2-20110721/datatypes.html#rf-pattern
I will add a test case to the repository to have this documented.
from ids.
<xs:pattern value="^.{3}(CA)(.{4}(MT))(.{4}(DTM)).*" />
please note that the pattern assumes a full match with the string, so you need to remove the initial ^
in your values.
from ids.
Presumably as a workaround you can use the built in OR operator in a regex. e.g. using | to separate the patterns
<xs:pattern value=".{3}(CA)(.{4}(MT))(.{4}(DTM)).*|.{3}(CN)(.{4}(AC))(.{4}(CNT)).*| etc " />
But obviously it make it pretty unwieldy.
from ids.
Apologies, I was not explicit enough earlier.
The proposed case is valid, with the following minor correction:
<propertySet>
<simpleValue>Pset_exemple</simpleValue>
</propertySet>
<name>
<simpleValue>WBS Code</simpleValue>
</name>
<value>
<xs:restriction base="xs:string">
<xs:pattern value=".{3}(CA)(.{4}(MT))(.{4}(DTM)).*" />
<xs:pattern value=".{3}(CN)(.{4}(AC))(.{4}(CNT)).*" />
<xs:pattern value=".{3}(CS)(.{4}(AS))(.{4}(ASS)).*" />
<xs:pattern value=".{3}(CS)(.{4}(SR))(.{4}(ARG|BAE|BIN|CCU|FLE|FSC|GEO|GRA|MUS|PAV|RIL|SCO|TVE)).*" />
<xs:pattern value=".{3}(CS)(.{4}(ST))(.{4}(BAE|BIN|CCU|FLE|FSC|GEO|MUS|PAV|SCO|TRN|TVE)).*" />
<xs:pattern value=".{3}(CV)(.{4}(FP))(.{4}(PMD)).*" />
<xs:pattern value=".{3}(CV)(.{4}(FS))(.{4}(PZF)).*" />
<xs:pattern value=".{3}(CV)(.{4}(IA))(.{4}(BIN|VEL)).*" />
<xs:pattern value=".{3}(CV)(.{4}(IC))(.{4}(BIN|CCP|CCU|GDI|MUS|PAV|PRE|SCA|TCC)).*" />
<xs:pattern value=".{3}(CV)(.{4}(PI))(.{4}(BAG|ISA|PUL|SEL)).*" />
<xs:pattern value=".{3}(CV)(.{4}(SP))(.{4}(BAG|ISA|MAN|MFP|RIE|SFL)).*" />
</xs:restriction>
</value>
The XML documentation at https://www.w3.org/TR/2011/CR-xmlschema11-2-20110721/datatypes.html#rf-pattern states that:
An XML containing more than one element gives rise to a single ·regular expression· in the set; this ·regular expression· is an "or" of the ·regular expressions· that are the content of the elements.
Therefore the restriction is considered a pass, if any of the provided patterns matches the value.
I don't see the need for the workaround you are proposing. Am I missing something?
from ids.
I don't see the need for the workaround you are proposing. Am I missing something?
I was just assuming this might need additional support/testing in the relevant implementations. e.g. I just checked XIDS and I don't think it's correctly de-serialising multiple patterns in this way , and may not be the only implementation to have overlooked this.
from ids.
I don't see the need for the workaround you are proposing. Am I missing something?
I was just assuming this might need additional support/testing in the relevant implementations. e.g. I just checked XIDS and I don't think it's correctly de-serialising multiple patterns in this way , and may not be the only implementation to have overlooked this.
Are you suggesting that we add an implementer agreement to constrain this?
from ids.
Are you suggesting that we add an implementer agreement to constrain this?
I'm not sure how best - but it feels like an edge case that may cause discrepancies if we don't formalise it. Can we cover off in the 'Complex restrictions' markdown somehow? And ideally have some test cases.
Is it just pattern that can be repeated like this in a restriction? The XSD docs don't appear indicate that any of the other Constraining Facets can be duplicated, so I guess pattern is an exception. E.g. An enumeration's 'or' operates at the next level down - so there's only ever one enumeration in a restriction.
from ids.
Presumably as a workaround you can use the built in OR operator in a regex. e.g. using | to separate the patterns
<xs:pattern value=".{3}(CA)(.{4}(MT))(.{4}(DTM)).*|.{3}(CN)(.{4}(AC))(.{4}(CNT)).*| etc " />
But obviously it make it pretty unwieldy.
I don't know if it can be useful but I did some tests and I get the result I want just by concatenating the patterns with the "|" separator even though it doesn't seem to be the most elegant solution it worked
from ids.
A combination of (multiple) patterns and other restrictions like enumerations, min/max restrictions, etc. is also possible.
from ids.
Related Issues (20)
- Format of values in IDS HOT 1
- Default branch settings HOT 1
- Data type of IfcLengthMeasure "Real" or "Double"? HOT 1
- List of datatypes with Enum types used by attributes HOT 6
- List of datatypes without IfcCompoundPlaneAngleMeasure HOT 2
- IfcLogical representation in XML base HOT 1
- IMPROVEMENT: functionality to point towards bSDD (data dictionaries) HOT 4
- IDS BIM
- Restriction of values: Enumeration limited to string-based datatype or do we allow for real, integer and measurements HOT 4
- Predefined type evaluation
- userdefuned HOT 6
- Test case naming consistency HOT 2
- 2 testcases have .html file instead of .ifc HOT 2
- Tolerance documentation 1.0.0 HOT 7
- Wrong file name in the entity directory of test cases HOT 1
- Tolerance test issues in 1.0 HOT 5
- Are complex restrictions applicable to all facet parameters? HOT 2
- Test case for indirect containment is incorrect
- Relation between enumerations in Applicability and Requirements HOT 2
- Broken links on dev Readme HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ids.