Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLNamedIndividual


        }
        String clsIRI = ((OWLClass) cls).getIRI().toString();
        if (IRI_CLASS_SYNONYMTYPEDEF.equals(clsIRI)) {
            Frame f = getObodoc().getHeaderFrame();
            Clause c = new Clause(OboFormatTag.TAG_SYNONYMTYPEDEF.getTag());
            OWLNamedIndividual indv = (OWLNamedIndividual) ax.getIndividual();
            String indvId = getIdentifier(indv);
            // TODO: full specify this in the spec document.
            // we may want to allow full IDs for subsets in future.
            // here we would have a convention that an unprefixed
            // subsetdef/synonymtypedef
            // gets placed in a temp ID space, and only this id space is
            // stripped
            indvId = indvId.replaceFirst(".*:", "");
            c.addValue(indvId);
            c.addValue(indvId);
            String nameValue = "";
            String scopeValue = null;
            for (OWLAnnotation ann : annotations(getOWLOntology()
                    .getAnnotationAssertionAxioms(indv.getIRI()))) {
                String propId = ann.getProperty().getIRI().toString();
                String value = ((OWLLiteral) ann.getValue()).getLiteral();
                if (OWLRDFVocabulary.RDFS_LABEL.getIRI().toString()
                        .equals(propId)) {
                    nameValue = '"' + value + '"';
                } else {
                    scopeValue = value;
                }
            }
            c.addValue(nameValue);
            if (scopeValue != null) {
                c.addValue(scopeValue);
            }
            f.addClause(c);
        } else if (IRI_CLASS_SUBSETDEF.equals(clsIRI)) {
            Frame f = getObodoc().getHeaderFrame();
            Clause c = new Clause(OboFormatTag.TAG_SUBSETDEF.getTag());
            OWLNamedIndividual indv = (OWLNamedIndividual) ax.getIndividual();
            String indvId = getIdentifier(indv);
            // TODO: full specify this in the spec document.
            // we may want to allow full IDs for subsets in future.
            // here we would have a convention that an unprefixed
            // subsetdef/synonymtypedef
            // gets placed in a temp ID space, and only this id space is
            // stripped
            indvId = indvId.replaceFirst(".*:", "");
            c.addValue(indvId);
            String nameValue = "";
            for (OWLAnnotation ann : annotations(getOWLOntology()
                    .getAnnotationAssertionAxioms(indv.getIRI()))) {
                String propId = ann.getProperty().getIRI().toString();
                String value = ((OWLLiteral) ann.getValue()).getLiteral();
                if (OWLRDFVocabulary.RDFS_LABEL.getIRI().toString()
                        .equals(propId)) {
                    nameValue = '"' + value + '"';
View Full Code Here


        }

        @Nullable
        @Override
        public OWLNamedIndividual getOWLIndividual(@Nonnull String name) {
            OWLNamedIndividual owlIndividual = defaultInstance
                    .getOWLIndividual(name);
            if (owlIndividual == null) {
                IRI iri = getIRI(name);
                if (iri != null) {
                    owlIndividual = getOWLIndividual(iri);
View Full Code Here

         * @return {@link OWLNamedIndividual} or null
         */
        @Nullable
        OWLNamedIndividual getOWLIndividual(@Nonnull IRI iri) {
            for (OWLOntology o : ontologies) {
                OWLNamedIndividual c = o.getOWLOntologyManager()
                        .getOWLDataFactory().getOWLNamedIndividual(iri);
                for (OWLDeclarationAxiom da : o.getDeclarationAxioms(c)) {
                    if (da.getEntity() instanceof OWLNamedIndividual) {
                        return (OWLNamedIndividual) da.getEntity();
                    }
View Full Code Here

        return getOWLNamedIndividual(name);
    }

    @Nonnull
    private OWLNamedIndividual getOWLNamedIndividual(@Nonnull String name) {
        OWLNamedIndividual ind = owlEntityChecker.getOWLIndividual(name);
        if (ind == null && individualNames.contains(name)) {
            ind = dataFactory.getOWLNamedIndividual(getIRI(name));
        }
        if (ind == null) {
            throw new ExceptionBuilder().withInd().build();
View Full Code Here

    }

    @Test
    public void shouldBuildNamedIndividual() {
        // given
        OWLNamedIndividual expected = df.getOWLNamedIndividual(iri);
        BuilderNamedIndividual builder = new BuilderNamedIndividual(expected,
                df);
        // when
        OWLObject built = builder.buildObject();
        // then
View Full Code Here

    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLNamedIndividual ind = NamedIndividual(iri("i"));
        OWLDataProperty prop = DataProperty(iri("prop"));
        OWLLiteral literal = Literal("Test \"literal\"\nStuff");
        axioms.add(DataPropertyAssertion(prop, ind, literal));
        return axioms;
    }
View Full Code Here

    }

    private void addAxiomForLiteral(@Nonnull OWLLiteral lit,
            @Nonnull Set<OWLAxiom> axioms) {
        OWLDataProperty prop = DataProperty(iri("p"));
        OWLNamedIndividual ind = NamedIndividual(iri("i"));
        axioms.add(DataPropertyAssertion(prop, ind, lit));
    }
View Full Code Here

        OWLDataFactory factory = manager.getOWLDataFactory();
        PrefixManager pm = new DefaultPrefixManager(null, null,
                ontologyIRI.toString());
        // Let's specify the :John has a wife :Mary Get hold of the necessary
        // individuals and object property
        OWLNamedIndividual john = factory.getOWLNamedIndividual(":John", pm);
        OWLNamedIndividual mary = factory.getOWLNamedIndividual(":Mary", pm);
        OWLObjectProperty hasWife = factory
                .getOWLObjectProperty(":hasWife", pm);
        // To specify that :John is related to :Mary via the :hasWife property
        // we create an object property assertion and add it to the ontology
        OWLObjectPropertyAssertionAxiom propertyAssertion = factory
View Full Code Here

        // Get the reference to the :Person class (the full IRI will be
        // <http://example.com/owl/families/Person>)
        OWLClass person = dataFactory.getOWLClass(":Person", pm);
        // Get the reference to the :Mary class (the full IRI will be
        // <http://example.com/owl/families/Mary>)
        OWLNamedIndividual mary = dataFactory
                .getOWLNamedIndividual(":Mary", pm);
        // Now create a ClassAssertion to specify that :Mary is an instance of
        // :Person
        OWLClassAssertionAxiom classAssertion = dataFactory
                .getOWLClassAssertionAxiom(person, mary);
View Full Code Here

        // the property values (property assertions in OWL speak) for a given
        // individual and property. Let's get the property values for the
        // individual Mick, the full IRI of which is
        // <http://owl.man.ac.uk/2005/07/sssw/people#Mick> Get a reference to
        // the individual Mick
        OWLNamedIndividual mick = fac.getOWLNamedIndividual(IRI
                .create("http://owl.man.ac.uk/2005/07/sssw/people#Mick"));
        // Let's get the pets of Mick Get hold of the has_pet property which has
        // a full IRI of <http://owl.man.ac.uk/2005/07/sssw/people#has_pet>
        OWLObjectProperty hasPet = fac.getOWLObjectProperty(IRI
                .create("http://owl.man.ac.uk/2005/07/sssw/people#has_pet"));
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.model.OWLNamedIndividual

Copyright © 2018 www.massapicom. 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.