org.semanticweb.owlapi.model.OWLDatatype Java Examples
The following examples show how to use
org.semanticweb.owlapi.model.OWLDatatype.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleOntologyValuesTest.java From mobi with GNU Affero General Public License v3.0 | 6 votes |
@Test public void testMobiLiteral() throws Exception { OWLLiteral owlLiteral = new OWLLiteralImplString("testString"); IRI iri = factory.createIRI("http://www.w3.org/2001/XMLSchema#string"); Literal literal = mock(Literal.class); Datatype datatype = mock(Datatype.class); expect(datatype.getIRI()).andReturn(iri).anyTimes(); expect(literal.getDatatype()).andReturn(iri).anyTimes(); expect(literal.getLabel()).andReturn("testString").anyTimes(); replay(literal, datatype); mockStaticPartial(SimpleOntologyValues.class, "mobiDatatype"); expect(SimpleOntologyValues.mobiDatatype(isA(OWLDatatype.class))).andReturn(datatype).anyTimes(); replay(SimpleOntologyValues.class); assertEquals("testString", SimpleOntologyValues.mobiLiteral(owlLiteral).getLabel()); assertEquals(iri, SimpleOntologyValues.mobiLiteral(owlLiteral).getDatatype()); }
Example #2
Source File: SimpleOntologyValuesTest.java From mobi with GNU Affero General Public License v3.0 | 6 votes |
@Test public void testMobiDatatype() throws Exception { OWLDatatype owlDatatype = mock(OWLDatatype.class); org.semanticweb.owlapi.model.IRI owlDatatypeIRI = mock(org.semanticweb.owlapi.model.IRI.class); IRI datatypeIRI = mock(IRI.class); expect(owlDatatype.getIRI()).andReturn(owlDatatypeIRI).anyTimes(); expect(owlDatatype.isBuiltIn()).andReturn(true).anyTimes(); expect(datatypeIRI.stringValue()).andReturn("http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral").anyTimes(); mockStaticPartial(SimpleOntologyValues.class, "mobiIRI", "owlapiIRI"); expect(SimpleOntologyValues.mobiIRI(owlDatatypeIRI)).andReturn(datatypeIRI).anyTimes(); expect(SimpleOntologyValues.owlapiIRI(datatypeIRI)).andReturn(owlDatatypeIRI).anyTimes(); mockStaticPartial(org.semanticweb.owlapi.model.IRI.class, "create"); expect(org.semanticweb.owlapi.model.IRI.create(isA(String.class), isA(String.class))).andReturn(owlDatatypeIRI).anyTimes(); replay(owlDatatype, owlDatatypeIRI, datatypeIRI, SimpleOntologyValues.class, org.semanticweb.owlapi.model.IRI.class); assertEquals(datatypeIRI, SimpleOntologyValues.mobiDatatype(owlDatatype).getIRI()); }
Example #3
Source File: SimpleOntologyValues.java From mobi with GNU Affero General Public License v3.0 | 5 votes |
/** * . */ public static Datatype mobiDatatype(OWLDatatype datatype) { if (datatype == null) { return null; } else { return new SimpleDatatype(datatype); } }
Example #4
Source File: ElkConverter.java From elk-reasoner with Apache License 2.0 | 5 votes |
@Override public OWLDatatype convert(ElkDatatype input) { if (input instanceof ElkDatatypeWrap<?>) { return ((ElkDatatypeWrap<?>) input).getOwlObject(); } // else return visit(input); }
Example #5
Source File: ManchesterOWLSyntaxObjectHTMLRenderer.java From robot with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** Given an OWLDataType, write a hyperlink describing it to the writer. */ @Override public void visit(OWLDatatype node) { write( String.format( "<a href=\"%s\">%s</a>", node.getIRI().toString(), getShortFormProvider().getShortForm(node))); }
Example #6
Source File: TemplateOperation.java From robot with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Find a datatype with the given name or create one. * * @param checker used to search by rdfs:label (for example) * @param name the name to search for * @return a datatype * @throws Exception if the name cannot be resolved */ @Deprecated public static OWLDatatype getDatatype(QuotedEntityChecker checker, String name) throws Exception { OWLDatatype datatype = TemplateHelper.getDatatype(checker, name); if (datatype == null) { throw new Exception( String.format("%sDATATYPE ERROR could not find datatype for '%s'", NS, name)); } return datatype; }
Example #7
Source File: QuotedEntityChecker.java From robot with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Find a datatype with the given name, or create one. Quotation marks will be removed if * necessary. * * @param name the name of the entity to find * @param create if false, do not create a new datatype * @return a datatype, or null */ public OWLDatatype getOWLDatatype(@Nonnull String name, boolean create) { IRI iri = getIRI(datatypes, name); if (iri != null) { return dataFactory.getOWLDatatype(iri); } if (create && ioHelper != null) { iri = ioHelper.createIRI(name, true); if (iri != null) { return dataFactory.getOWLDatatype(iri); } } return null; }
Example #8
Source File: EntityCreationVisitor.java From OWL2VOWL with MIT License | 5 votes |
@Override public void visit(OWLDatatype node) { if (node.getIRI().toString().equals(VowlLiteral.LITERAL_IRI)) { // Skip generic literal. Already included in the data as default. return; } vowlData.addDatatype(new VowlDatatype(node.getIRI())); }
Example #9
Source File: SimpleOntologyValues.java From mobi with GNU Affero General Public License v3.0 | 4 votes |
/** * . */ public static OWLDatatype owlapiDatatype(Datatype datatype) { return new OWLDatatypeImpl(owlapiIRI(datatype.getIRI())); }
Example #10
Source File: SimpleDatatype.java From mobi with GNU Affero General Public License v3.0 | 4 votes |
public SimpleDatatype(OWLDatatype owlDatatype) { this.iri = SimpleOntologyValues.mobiIRI(owlDatatype.getIRI()); this.owlDatatype = owlDatatype; builtin = owlDatatype.isBuiltIn(); }
Example #11
Source File: AbstractElkObjectConverter.java From elk-reasoner with Apache License 2.0 | 4 votes |
@Override public OWLDatatype visit(ElkDatatype expression) { return owlFactory_.getOWLDatatype(convert(expression.getIri())); }
Example #12
Source File: OwlConverter.java From elk-reasoner with Apache License 2.0 | 4 votes |
@SuppressWarnings("static-method") public ElkDatatype convert(OWLDatatype owlDatatype) { return new ElkDatatypeWrap<OWLDatatype>(owlDatatype); }
Example #13
Source File: OwlDataRangeConverterVisitor.java From elk-reasoner with Apache License 2.0 | 4 votes |
@Override public ElkDatatype visit(OWLDatatype owlDatatype) { return CONVERTER.convert(owlDatatype); }
Example #14
Source File: OwlEntityConverterVisitor.java From elk-reasoner with Apache License 2.0 | 4 votes |
@Override public ElkDatatype visit(OWLDatatype owlDatatype) { return CONVERTER.convert(owlDatatype); }
Example #15
Source File: QuotedEntityChecker.java From robot with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * Find a datatype with the given name, or create one. Quotation marks will be removed if * necessary. * * @param name the name of the entity to find * @return a datatype, or null */ @Override public OWLDatatype getOWLDatatype(@Nonnull String name) { return getOWLDatatype(name, true); }
Example #16
Source File: AbstractElkObjectConverter.java From elk-reasoner with Apache License 2.0 | votes |
abstract OWLDatatype convert(ElkDatatype input);