Comments (8)
We need to figure out if this is possible in native XSD, and if so this can go into 2.1. If it takes more effort (such as schematron), we should push this out.
from schemas.
We should be able to add something like this to all root-level elements
<xs:unique name="unique-id">
<xs:selector xpath=".//*"/>
<xs:field xpath="@id"/>
</xs:unique>
from schemas.
Thanks @bworrell! I tested that out and it seems to work well. I have added it to the version 2.1 branch in commit 57e6df9.
from schemas.
Is this limited to @id
attributes in the CybOX namespace or does it propagate to schemas that import CybOX? If it propagates we might want to limit it to @id
attributes in the CybOX namespaces only?
from schemas.
Good question @johnwunder! I believe it will be applied to all @id
attributes under a given root CybOX structure, so even those @id
attributes on constructs defined outside the CybOX namespace. Luckily, the only external schema that CybOX imports is CPE, which also has uniqueness constraints on its ids.
from schemas.
The commit 57e6df9 adds that uniqueness constraint to the root, Observables
element, but not the other allowable root elements. I thought that it'd have to be added to Observable
, Action
, Object
, Event
, and Property
as well.
from schemas.
Good point @bworrell. However, it seems to apply to any elements under cybox:Observables that have ids, including the ones you listed.
EDIT - nevermind, I see what you're saying! Since we allow multiple possible root elements (not just Observables), we need the same construct in the rest to ensure that unique IDs are enforced if they are used as the root element of the document. This is completely valid so I'll go ahead and add the constraint to these as well.
from schemas.
I did fairly extensive testing on this and couldn't find any problems with it.
The only slight complexity I found is that schemas importing CybOX (e.g. STIX) may need to apply their own uniqueness constraints depending on whether they use an element reference into a global CybOX element or a type reference to the corresponding complexType. Nothing is necessarily broken in CybOX (and since you can only apply uniqueness constraints at the element level there's no way to avoid it), but schemas importing CybOX should be aware of the issue.
from schemas.
Related Issues (20)
- WhoisObj:WhoisContactType is defined in a non-standard way
- No default Controlled Vocabulary for LinuxPackageObjectType.Architecture
- VolumeObj:VolumeOptionType is abstract, but never extended
- Use of xs:choice when only one element is specified
- Choice implemented in a non-standard way for NetworkFlowObj:NetflowV9DataRecordType
- Issues around Object Subclassing
- Inconsistency in Object Relationship Expression HOT 1
- IANAPortNumberRegistryType Data Type is used only in Network Flow, but defined in Network Packet
- Consider Deprecating Socket Address Object
- Consider Simplifying/Refactoring ExtractedFeaturesType
- Refactor/Deprecate Base DataTypes HOT 1
- Consider Refactoring/Clarifying User Session
- Consider Deprecating Pools
- WindowExecutableFileType/DOSHeaderType is specified incorrectly.
- Create Separate Patterning Syntax/Language
- Determine Patterning Language Operators HOT 2
- Determine Patterning Language Syntax HOT 1
- We need a way of recording web forum postings and credential dumps HOT 1
- Typo in DOS Header Schema
- No data XML representation for PDFIndirectObject of PDFFile HOT 2
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 schemas.