本文整理汇总了Java中org.w3c.ddr.simple.PropertyRef类的典型用法代码示例。如果您正苦于以下问题:Java PropertyRef类的具体用法?Java PropertyRef怎么用?Java PropertyRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertyRef类属于org.w3c.ddr.simple包,在下文中一共展示了PropertyRef类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listPropertyRefs
import org.w3c.ddr.simple.PropertyRef; //导入依赖的package包/类
public PropertyRef[] listPropertyRefs() {
List<PropertyRef> propertyRefsList = new ArrayList<PropertyRef>();
Map<String, Vocabulary> vocabularies = vocabularyHolder.getVocabularies();
Set<String> vocabularyKeys = vocabularies.keySet();
for (String vocabularyKey : vocabularyKeys) {
Vocabulary vocabulary = vocabularies.get(vocabularyKey);
Map<String, VocabularyProperty> properties = vocabulary.getProperties();
Set<String> propertyKeys = properties.keySet();
for (String propertyKey : propertyKeys) {
PropertyName propertyName = new ODDRPropertyName(propertyKey, vocabularyKey);
for (int i = 0; i < properties.get(propertyKey).getAspects().length; i++) {
PropertyRef propertyRef = new ODDRPropertyRef(propertyName, properties.get(propertyKey).getAspects()[i]);
propertyRefsList.add(propertyRef);
}
}
}
PropertyRef[] propertyRefs = new PropertyRef[propertyRefsList.size()];
propertyRefs = propertyRefsList.toArray(propertyRefs);
return propertyRefs;
}
示例2: assertProperties
import org.w3c.ddr.simple.PropertyRef; //导入依赖的package包/类
static void assertProperties(Properties expected, PropertyValues actual, PropertyRef [] refs) throws NameException, ValueException {
assertNotNull("Expecting non-null PropertyValues", actual);
assertFalse("Expected properties should not be empty", expected.isEmpty());
for(Object k : expected.keySet()) {
final String name = k.toString();
PropertyRef ref = null;
for(PropertyRef pr : refs) {
if(pr.getLocalPropertyName().equals(name)) {
ref = pr;
break;
}
}
assertNotNull("ref '" + name + "' should be found", ref);
final PropertyValue pv = actual.getValue(ref);
assertTrue("Expecting property '" + name + "' to be found for current device", pv.exists());
final String value = pv.getString();
final String expectedValue = expected.getProperty(name);
assertEquals("Expecting value " + expectedValue + " for "
+ name, expectedValue, value);
}
}
示例3: getValue
import org.w3c.ddr.simple.PropertyRef; //导入依赖的package包/类
public PropertyValue getValue(PropertyRef pr) throws NameException {
for (PropertyValue propertyValue : properties) {
if (propertyValue.getPropertyRef().equals(pr)) {
return propertyValue;
}
}
return null;
//throw new NameException(NameException.PROPERTY_NOT_RECOGNIZED, new IllegalArgumentException());
}
示例4: getPropertyValues
import org.w3c.ddr.simple.PropertyRef; //导入依赖的package包/类
public PropertyValues getPropertyValues(Evidence evdnc, String localAspectName, String vocabularyIRI) throws NameException {
VocabularyProperty vocabularyProperty = vocabularyHolder.existProperty(localAspectName, null, vocabularyIRI);
PropertyName propertyName = new ODDRPropertyName(localAspectName, vocabularyIRI);
PropertyRef propertyRef = new ODDRPropertyRef(propertyName, vocabularyProperty.getDefaultAspect());
return getPropertyValues(evdnc, new PropertyRef[]{propertyRef});
}
示例5: getPropertyRefs
import org.w3c.ddr.simple.PropertyRef; //导入依赖的package包/类
static PropertyRef [] getPropertyRefs(Service s, String ... names) {
final PropertyRef [] result = new PropertyRef[names.length];
try {
for(int i=0; i < names.length; i++) {
result[i] = s.newPropertyRef(names[i]);
}
} catch(Exception e) {
throw new RuntimeException("Exception while creating PropertyRefs", e);
}
return result;
}
示例6: ODDRPropertyValue
import org.w3c.ddr.simple.PropertyRef; //导入依赖的package包/类
public ODDRPropertyValue(String value, String type, PropertyRef propertyRef) {
this.value = (value == null ? value : value.trim());
this.type = type;
this.propertyRef = propertyRef;
}
示例7: getPropertyRef
import org.w3c.ddr.simple.PropertyRef; //导入依赖的package包/类
public PropertyRef getPropertyRef() {
return propertyRef;
}
示例8: getPropertyValue
import org.w3c.ddr.simple.PropertyRef; //导入依赖的package包/类
public PropertyValue getPropertyValue(Evidence evdnc, PropertyRef pr) throws NameException {
return getPropertyValues(evdnc, new PropertyRef[]{pr}).getValue(pr);
}
示例9: newPropertyRef
import org.w3c.ddr.simple.PropertyRef; //导入依赖的package包/类
public PropertyRef newPropertyRef(PropertyName pn, String localAspectName) throws NameException {
vocabularyHolder.existProperty(pn.getLocalPropertyName(), localAspectName, pn.getNamespace());
return new ODDRPropertyRef(pn, localAspectName);
}