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


Java OWLAnnotationProperty类代码示例

本文整理汇总了Java中cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty的典型用法代码示例。如果您正苦于以下问题:Java OWLAnnotationProperty类的具体用法?Java OWLAnnotationProperty怎么用?Java OWLAnnotationProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OWLAnnotationProperty类属于cz.cvut.kbss.jopa.model.annotations包,在下文中一共展示了OWLAnnotationProperty类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createForEntityLoadingIncludesMappedSuperclassAttributes

import cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty; //导入依赖的package包/类
@Test
public void createForEntityLoadingIncludesMappedSuperclassAttributes() throws Exception {
    final Descriptor desc = new EntityDescriptor();
    final AxiomDescriptor res = factory.createForEntityLoading(loadingParameters(OWLClassQ.class, desc),
            metamodelMocks.forOwlClassQ().entityType());
    final Set<String> propertyIris = OWLClassQ.getPersistentFields().stream().map(f -> {
        if (f.getAnnotation(OWLDataProperty.class) != null) {
            return f.getAnnotation(OWLDataProperty.class).iri();
        } else if (f.getAnnotation(OWLObjectProperty.class) != null) {
            return f.getAnnotation(OWLObjectProperty.class).iri();
        } else {
            return f.getAnnotation(OWLAnnotationProperty.class).iri();
        }
    }).collect(Collectors.toSet());
    final Set<Assertion> assertions = res.getAssertions();
    // + class assertion
    assertEquals(OWLClassQ.getPersistentFields().size() + 1, assertions.size());
    for (Assertion a : assertions) {
        if (a.getType() != Assertion.AssertionType.CLASS) {
            assertTrue(propertyIris.contains(a.getIdentifier().toString()));
        }
    }
}
 
开发者ID:kbss-cvut,项目名称:jopa,代码行数:24,代码来源:AxiomDescriptorFactoryTest.java

示例2: reconstructsInstanceWithMappedSuperclass

import cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty; //导入依赖的package包/类
@Test
public void reconstructsInstanceWithMappedSuperclass() throws Exception {
    final Set<Axiom<?>> axioms = new HashSet<>();
    axioms.add(getClassAssertionAxiomForType(OWLClassQ.getClassIri()));
    axioms.add(getStringAttAssertionAxiom(OWLClassQ.getStringAttributeField()));
    axioms.add(getStringAttAssertionAxiom(OWLClassQ.getParentStringField()));
    final URI labelUri = URI.create(OWLClassQ.getLabelField().getAnnotation(OWLAnnotationProperty.class).iri());
    axioms.add(new AxiomImpl<>(PK_RESOURCE, Assertion.createAnnotationPropertyAssertion(labelUri, false),
            new Value<>(STRING_ATT)));
    final URI owlClassAUri = URI.create(OWLClassQ.getOwlClassAField().getAnnotation(OWLObjectProperty.class).iri());
    axioms.add(new AxiomImpl<>(PK_RESOURCE, Assertion.createObjectPropertyAssertion(owlClassAUri, false),
            new Value<>(NamedResource.create(PK_TWO))));
    final OWLClassA a = new OWLClassA();
    a.setUri(PK_TWO);
    when(mapperMock.getEntityFromCacheOrOntology(eq(OWLClassA.class), eq(PK_TWO), any(Descriptor.class)))
            .thenReturn(a);

    final OWLClassQ res = constructor.reconstructEntity(PK, mocks.forOwlClassQ().entityType(), descriptor, axioms);
    assertNotNull(res);
    assertEquals(PK, res.getUri());
    assertEquals(STRING_ATT, res.getStringAttribute());
    assertEquals(STRING_ATT, res.getParentString());
    assertEquals(STRING_ATT, res.getLabel());
    assertSame(a, res.getOwlClassA());
}
 
开发者ID:kbss-cvut,项目名称:jopa,代码行数:26,代码来源:EntityConstructorTest.java

示例3: resolveCProperties

import cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty; //导入依赖的package包/类
private List<String> resolveCProperties() throws Exception {
    final List<String> lst = new ArrayList<>();
    for (Field f : OWLClassC.class.getDeclaredFields()) {
        if (f.getAnnotation(Id.class) != null || EntityPropertiesUtils.isFieldTransient(f)) {
            continue;
        }
        if (f.getAnnotation(OWLDataProperty.class) != null) {
            lst.add(f.getAnnotation(OWLDataProperty.class).iri());
        } else if (f.getAnnotation(OWLObjectProperty.class) != null) {
            lst.add(f.getAnnotation(OWLObjectProperty.class).iri());
        } else if (f.getAnnotation(OWLAnnotationProperty.class) != null) {
            lst.add(f.getAnnotation(OWLAnnotationProperty.class).iri());
        }
    }
    return lst;
}
 
开发者ID:kbss-cvut,项目名称:jopa,代码行数:17,代码来源:DeleteOperationsRunner.java

示例4: containsAPAssertion

import cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty; //导入依赖的package包/类
private boolean containsAPAssertion(AxiomValueDescriptor descriptor, Field attributeField, Object value,
                                    boolean checkSingle) {
    final URI propertyUri = URI.create(attributeField.getAnnotation(OWLAnnotationProperty.class).iri());
    final Assertion assertion = Assertion
            .createAnnotationPropertyAssertion(propertyUri, attributeField.getAnnotation(Inferred.class) != null);
    return containsAssertionValue(descriptor, assertion, value, checkSingle);
}
 
开发者ID:kbss-cvut,项目名称:jopa,代码行数:8,代码来源:EntityDeconstructorTest.java

示例5: ensureCreated

import cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty; //导入依赖的package包/类
private JDefinedClass ensureCreated(final ContextDefinition ctx,
                                    final String pkg, final JCodeModel cm, final OWLClass clazz,
                                    final OWLOntology ontology) {
    if (classes.containsKey(clazz)) {
        return classes.get(clazz);
    }

    JDefinedClass cls;

    String name = pkg + javaClassId(ontology, clazz, ctx);

    try {
        cls = cm._class(name);

        cls.annotate(
                cz.cvut.kbss.jopa.model.annotations.OWLClass.class)
           .param("iri", entities.get(clazz));

        final JDocComment dc = cls.javadoc();
        dc.add("This class was generated by the OWL2Java tool version " + VERSION);

        // if (clazz.equals(f.getOWLThing())) {
        // RDFS label
        final JClass ftLabel = cm.ref(String.class);
        final JFieldVar fvLabel = addField("name", cls, ftLabel);
        fvLabel.annotate(OWLAnnotationProperty.class).param("iri",
                cm.ref(CommonVocabulary.class).staticRef("RDFS_LABEL"));

        // DC description
        final JClass ftDescription = cm.ref(String.class);
        final JFieldVar fvDescription = addField("description", cls, ftDescription);
        fvDescription.annotate(OWLAnnotationProperty.class).param("iri",
                cm.ref(CommonVocabulary.class).staticRef("DC_DESCRIPTION"));

        // @Types Set<String> types;
        final JClass ftTypes = cm.ref(Set.class).narrow(String.class);
        final JFieldVar fvTypes = addField("types", cls, ftTypes);
        fvTypes.annotate(Types.class);

        // @Id public final String id;
        final JClass ftId = cm.ref(String.class);
        final JFieldVar fvId = addField("id", cls, ftId);
        JAnnotationUse a = fvId.annotate(Id.class);

        a.param("generated", true);

        // @Properties public final Map<String,Set<String>> properties;
        final JClass ftProperties = cm.ref(Map.class).narrow(
                cm.ref(String.class),
                cm.ref(Set.class).narrow(String.class));
        final JFieldVar fvProperties = addField("properties", cls,
                ftProperties);
        fvProperties.annotate(Properties.class);
        // }

    } catch (JClassAlreadyExistsException e) {
        LOG.trace("Class already exists. Using the existing version. {}", e.getMessage());
        cls = cm._getClass(name);
    }
    classes.put(clazz, cls);

    return cls;
}
 
开发者ID:kbss-cvut,项目名称:jopa,代码行数:64,代码来源:JavaTransformer.java


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