当前位置: 首页>>代码示例>>Java>>正文


Java PropertyRef类代码示例

本文整理汇总了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;
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:24,代码来源:DDRService.java

示例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);
    }
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:22,代码来源:Util.java

示例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());
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:10,代码来源:ODDRPropertyValues.java

示例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});
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:9,代码来源:DDRService.java

示例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;
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:12,代码来源:Util.java

示例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;
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:6,代码来源:ODDRPropertyValue.java

示例7: getPropertyRef

import org.w3c.ddr.simple.PropertyRef; //导入依赖的package包/类
public PropertyRef getPropertyRef() {
    return propertyRef;
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:4,代码来源:ODDRPropertyValue.java

示例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);
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:4,代码来源:DDRService.java

示例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);
}
 
开发者ID:OpenDDRmobi,项目名称:openddr-java,代码行数:5,代码来源:DDRService.java


注:本文中的org.w3c.ddr.simple.PropertyRef类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。