Package org.semanticweb.owlapi.io

Examples of org.semanticweb.owlapi.io.RDFLiteral


                        for (RDFNode n : list) {
                            if (n.isAnonymous()) {
                                render((RDFResourceBlankNode) n);
                            } else {
                                if (n.isLiteral()) {
                                    RDFLiteral litNode = (RDFLiteral) n;
                                    writer.writeStartElement(RDFS_LITERAL
                                            .getIRI());
                                    if (!litNode.isPlainLiteral()) {
                                        writer.writeDatatypeAttribute(litNode
                                                .getDatatype());
                                    } else if (litNode.hasLang()) {
                                        writer.writeLangAttribute(litNode
                                                .getLang());
                                    }
                                    writer.writeTextContent(litNode
                                            .getLexicalValue());
                                    writer.writeEndElement();
                                } else {
                                    writer.writeStartElement(RDF_DESCRIPTION
                                            .getIRI());
                                    writer.writeAboutAttribute(n.getIRI());
                                    writer.writeEndElement();
                                }
                            }
                        }
                    } else {
                        render(objectRes);
                    }
                } else {
                    writer.writeResourceAttribute(objectRes.getIRI());
                }
            } else {
                RDFLiteral rdfLiteralNode = (RDFLiteral) objectNode;
                if (!rdfLiteralNode.isPlainLiteral()) {
                    writer.writeDatatypeAttribute(rdfLiteralNode.getDatatype());
                } else if (rdfLiteralNode.hasLang()) {
                    writer.writeLangAttribute(rdfLiteralNode.getLang());
                }
                writer.writeTextContent(rdfLiteralNode.getLexicalValue());
            }
            writer.writeEndElement();
        }
        writer.writeEndElement();
        pending.remove(node);
View Full Code Here


        return new RDFResourceBlankNode(System.identityHashCode(key));
    }

    @Override
    protected RDFLiteral getLiteralNode(@Nonnull OWLLiteral literal) {
        return new RDFLiteral(literal);
    }
View Full Code Here

            } catch (IllegalArgumentException iae) {
                LOGGER.error("Object URI was invalid: {}", triple);
                return Collections.emptyList();
            }
        } else if (triple.getObject() instanceof RDFLiteral) {
            final RDFLiteral literalObject = (RDFLiteral) triple.getObject();
            // TODO: When updating to Sesame-2.8 the following may need to be
            // rewritten
            if (literalObject.isPlainLiteral()) {
                if (literalObject.hasLang()) {
                    object = vf.createLiteral(literalObject.getLexicalValue(),
                            literalObject.getLang());
                } else {
                    object = vf.createLiteral(literalObject.getLexicalValue());
                }
            } else {
                object = vf.createLiteral(literalObject.getLexicalValue(),
                        vf.createURI(literalObject.getDatatype().toString()));
            }
        } else {
            // FIXME: When blank nodes are no longer represented as IRIs
            // internally, need to fix
            // this
View Full Code Here

                IRI.create("urn:test:subject:uri:1"));
        RDFResourceIRI testOwlApiPredicateUri1 = new RDFResourceIRI(
                IRI.create("urn:test:predicate:uri:1"));
        RDFResourceIRI testOwlApiObjectUri1 = new RDFResourceIRI(
                IRI.create("urn:test:object:uri:1"));
        RDFLiteral testOwlApiObjectPlainLiteral1 = new RDFLiteral(
                "Test literal", "", null);
        RDFLiteral testOwlApiObjectLangLiteral1 = new RDFLiteral(
                "Test literal", "en", null);
        RDFLiteral testOwlApiObjectTypedLiteral1 = new RDFLiteral(
                "Test literal", null, IRI.create("urn:test:datatype:1"));
        RDFResourceBlankNode testOwlApiSubjectBNode1 = new RDFResourceBlankNode(
                IRI.create("subjectBnode1"));
        RDFResourceBlankNode testOwlApiObjectBNode1 = new RDFResourceBlankNode(
                IRI.create("objectBnode1"));
View Full Code Here

    @Nonnull
    private RDFTriple getRDFTriple(@Nonnull IRI subject,
            @Nonnull IRI predicate, @Nonnull OWLLiteral object) {
        return new RDFTriple(getRDFResource(subject), new RDFResourceIRI(
                predicate), new RDFLiteral(object));
    }
View Full Code Here

                }

                @Nonnull
                @Override
                public RDFNode visit(OWLLiteral literal) {
                    return new RDFLiteral(literal);
                }
            };
            RDFNode node = anno.getValue().accept(valVisitor);
            graph.addTriple(new RDFTriple(ontologyHeaderNode,
                    new RDFResourceIRI(anno.getProperty().getIRI()), node));
View Full Code Here

        return new RDFTriple(getRDFResource(subject), getRDFResource(predicate), getRDFResource(object));
    }


    private RDFTriple getRDFTriple(IRI subject, IRI predicate, OWLLiteral object) {
        return new RDFTriple(getRDFResource(subject), getRDFResource(predicate), new RDFLiteral(object));
    }
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.io.RDFLiteral

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.