API を使用したビジネス・モデルのインスタンスの作成
ここに示すコード例では、サンプル・システム・ファイルで定義されている ビジネス・モデルに基づいて概念を作成しています。
サンプルのビジネス・モデル・テンプレート ModellingClassExtension には、1 つのプロパティーと 1 つの関係があります。
プロパティー名または関係名は、次の形式で接頭部、下線、および ID を組み合わせたものです。
接頭部である wsrr:prefix は、.owl ファイルのオントロジーで定義されます。ID である rdf:ID は、.owl ファイルで定義されたプロパティーの ID です。例については、ModellingSample.owl ファイルへの関連リンクを参照してください。
- wsrr:prefix_rdf:ID
API を使用してビジネス・モデルのインスタンスを作成するためのサンプル・コードについては、以下の例に説明があります。
GenericObject go =
(GenericObject)DataFactory.INSTANCE.create
(com.ibm.serviceregistry.sdo.GenericObject.class);
go.setName("test");
// set the business model primary type
go.setPrimaryType("http://you.com/namespace#ModellingClassExtension");
try {
// add the property - note this has to be an NCName. The name of the property
// is based on the prefix specfied in the Ontology and the name of the property
// as defined in the owl file
BSRSDOHelper.INSTANCE.addProperty(go, "yns_StringProperty", "value");
// add the relationship - note this has to be an NCName.
// The name of the relationship is based on the prefix specfied in the Ontology
// and the name of the relationship as defined in the owl file
BSRSDOHelper.INSTANCE.addRelationship(go, "yns_RelationshipObject");
} catch (ServiceRegistryInvalidPropertyException e) {
} catch (ServiceRegistryInvalidRelationshipException e) {
ビジネス・モデル・システム・ファイルの詳細については、関連する参考情報を参照してください。
注: ビジネス・モデル・バリデーターにより、以下のデフォルト値が設定されます。
"http://www.w3.org/2001/XMLSchema#anyURI"; urn:serviceregistry
"http://www.w3.org/2001/XMLSchema#boolean"; false
"http://www.w3.org/2001/XMLSchema#int"; 0
"http://www.w3.org/2001/XMLSchema#integer"; 0
"http://www.w3.org/2001/XMLSchema#short"; 0
"http://www.w3.org/2001/XMLSchema#long"; 0
"http://www.w3.org/2001/XMLSchema#float"; 0.0
"http://www.w3.org/2001/XMLSchema#double"; 0.0
"http://www.w3.org/2001/XMLSchema#dateTime"; Current date and time
"http://www.w3.org/2001/XMLSchema#time"; Current time
"http://www.w3.org/2001/XMLSchema#date"; Current date