當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。