Package com.hp.hpl.jena.ontology

Examples of com.hp.hpl.jena.ontology.OntModel.createResource()


    }
   
    private void doTestDatatypeRangeValidation(RDFDatatype over12Type, OntModelSpec spec) {
        String NS = "http://jena.hpl.hp.com/example#";
        OntModel ont = ModelFactory.createOntologyModel(spec);
        Resource over12 = ont.createResource( over12Type.getURI() );
        DatatypeProperty hasValue = ont.createDatatypeProperty(NS + "hasValue");
        hasValue.addRange( over12 );
       
        ont.createResource(NS + "a").addProperty(hasValue, "15", over12Type);
        ont.createResource(NS + "b").addProperty(hasValue, "16", XSDDatatype.XSDinteger);
View Full Code Here


        OntModel ont = ModelFactory.createOntologyModel(spec);
        Resource over12 = ont.createResource( over12Type.getURI() );
        DatatypeProperty hasValue = ont.createDatatypeProperty(NS + "hasValue");
        hasValue.addRange( over12 );
       
        ont.createResource(NS + "a").addProperty(hasValue, "15", over12Type);
        ont.createResource(NS + "b").addProperty(hasValue, "16", XSDDatatype.XSDinteger);
        ont.createResource(NS + "c").addProperty(hasValue, "10", XSDDatatype.XSDinteger);
       
        ValidityReport validity = ont.validate();
        assertTrue (! validity.isValid());
View Full Code Here

        Resource over12 = ont.createResource( over12Type.getURI() );
        DatatypeProperty hasValue = ont.createDatatypeProperty(NS + "hasValue");
        hasValue.addRange( over12 );
       
        ont.createResource(NS + "a").addProperty(hasValue, "15", over12Type);
        ont.createResource(NS + "b").addProperty(hasValue, "16", XSDDatatype.XSDinteger);
        ont.createResource(NS + "c").addProperty(hasValue, "10", XSDDatatype.XSDinteger);
       
        ValidityReport validity = ont.validate();
        assertTrue (! validity.isValid());
       
View Full Code Here

        DatatypeProperty hasValue = ont.createDatatypeProperty(NS + "hasValue");
        hasValue.addRange( over12 );
       
        ont.createResource(NS + "a").addProperty(hasValue, "15", over12Type);
        ont.createResource(NS + "b").addProperty(hasValue, "16", XSDDatatype.XSDinteger);
        ont.createResource(NS + "c").addProperty(hasValue, "10", XSDDatatype.XSDinteger);
       
        ValidityReport validity = ont.validate();
        assertTrue (! validity.isValid());
       
        // Check culprit reporting
View Full Code Here

        OntModel model = ModelFactory.createOntologyModel();
        model.read(kvis, null, "RDF/XML");

        // add kam resource
        Resource kamResource =
                model.createResource(new AnonId(UUID.randomUUID().toString()));

        // kam type KAM
        kamResource.addProperty(RDF.type, KAM);

        // kam hasName "kam"^^xsd:string
View Full Code Here

        Map<Integer, Resource> annotations = new HashMap<Integer, Resource>();

        List<BelDocumentInfo> docs = kAMStore.getBelDocumentInfos(kamInfo);
        for (BelDocumentInfo doc : docs) {
            Resource docResource =
                    model.createResource(new AnonId(UUID.randomUUID()
                            .toString()));
            docResource.addProperty(RDF.type, BelDocument);

            // handle document fields
            if (doc.getAuthors() != null) {
View Full Code Here

            }

            List<Namespace> namespaces = doc.getNamespaces();
            for (Namespace namespace : namespaces) {
                // add namespace resource by it's URL
                Resource namespaceResource = model.createResource(namespace
                        .getResourceLocation());
                namespaceResource.addProperty(RDF.type, Namespace);

                // associate prefix and resource location
                namespaceResource.addProperty(hasPrefix,
View Full Code Here

                final Resource annotationDefResource;

                switch (annotationType.getAnnotationDefinitionType()) {
                case ENUMERATION:
                    annotationDefResource =
                            model
                                    .createResource(new AnonId(UUID
                                            .randomUUID().toString()));

                    // associate metadata of annotation type
                    annotationDefResource.addProperty(hasName,
View Full Code Here

                        // iterate domain to pre-build RDF resources and associate domain value
                        Resource[] itemResources = new Resource[domain.size()];
                        String[] domainValues =
                                domain.toArray(new String[domain.size()]);
                        for (int i = 0; i < domainValues.length; i++) {
                            itemResources[i] = model
                                    .createResource(new AnonId(UUID
                                            .randomUUID().toString()));
                            itemResources[i].addProperty(RDF.type, RDF.List);
                            itemResources[i].addProperty(RDF.first,
                                    model.createTypedLiteral(domainValues[i]));
View Full Code Here

                                "Expecting a single, Regular Expression pattern, but received: "
                                        + domain);
                    }

                    annotationDefResource =
                            model
                                    .createResource(new AnonId(UUID
                                            .randomUUID().toString()));

                    // associate metadata of annotation type
                    annotationDefResource.addProperty(hasName,
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.