public Object visit(OWLDatatypeRestriction object) { if (!(object.getDatatype().isOWLDatatype())) throw new IllegalArgumentException("Datatype restrictions are supported only on OWL datatypes."); String datatypeURI=object.getDatatype().getIRI().toString(); if (InternalDatatype.RDFS_LITERAL.getIRI().equals(datatypeURI)) { if (!object.getFacetRestrictions().isEmpty()) throw new IllegalArgumentException("rdfs:Literal does not support any facets."); return InternalDatatype.RDFS_LITERAL; } String[] facetURIs=new String[object.getFacetRestrictions().size()]; Constant[] facetValues=new Constant[object.getFacetRestrictions().size()]; int index=0; for (OWLFacetRestriction facet : object.getFacetRestrictions()) { facetURIs[index]=facet.getFacet().getIRI().toURI().toString(); facetValues[index]=(Constant)facet.getFacetValue().accept(this); index++; } DatatypeRestriction datatype=DatatypeRestriction.create(datatypeURI,facetURIs,facetValues); DatatypeRegistry.validateDatatypeRestriction(datatype); return datatype; }
@Override public void addToOntology() { OWLDatatype datatype = factory.getOWLDatatype(":DatatypeRestrictionDatatype", pm); OWLFacetRestriction fr1 = factory.getOWLFacetRestriction(OWLFacet.MIN_LENGTH, 10); OWLLiteral patternLiteral = factory.getOWLLiteral("DatatypeRestrictionLiteral"); OWLFacetRestriction fr2 = factory.getOWLFacetRestriction(OWLFacet.PATTERN, patternLiteral); OWLDatatypeRestriction restriction = factory.getOWLDatatypeRestriction(datatype, fr1, fr2); OWLDataProperty property = factory.getOWLDataProperty(":datatypeRestrictionProperty", pm); addToGenericDomainAndNewRange(property, restriction); }
@Override public OWLDataRange visit(OWLDatatypeRestriction node) { if (negated) { return dataFactory.getOWLDataComplementOf(node); } else { return node; } }
@Override public void visit(@Nonnull OWLDatatypeRestriction node) { node.getDatatype().accept(this); for (OWLFacetRestriction facetRestriction : node.getFacetRestrictions()) { facetRestriction.accept(this); } }
protected static boolean isAtomic(OWLDataRange dr) { return dr instanceof OWLDatatype || dr instanceof OWLDatatypeRestriction || dr instanceof OWLDataOneOf; }
public OWLDataRange visit(OWLDatatypeRestriction node) { return node; }
public OWLDataRange visit(OWLDatatypeRestriction o) { return o; }
public OWLDataRange visit(OWLDatatypeRestriction o) { return m_factory.getOWLDataComplementOf(o); }
public void visit(OWLDatatypeRestriction node) { LiteralDataRange literalRange=m_dataRangeConverter.convertDataRange(node); m_headAtoms.add(Atom.create((DLPredicate)literalRange,X)); }
@Override public OWLDatatypeRestriction visit(ElkDatatypeRestriction expression) { return owlFactory_.getOWLDatatypeRestriction( convert(expression.getDatatype()), toFacetRestrictionSet(expression.getFacetRestrictions())); }
@SuppressWarnings("static-method") public ElkDatatypeRestriction convert( OWLDatatypeRestriction owlDatatypeRestriction) { return new ElkDatatypeRestrictionWrap<OWLDatatypeRestriction>( owlDatatypeRestriction); }
@Override public ElkDatatypeRestriction visit( OWLDatatypeRestriction owlDatatypeRestriction) { return CONVERTER.convert(owlDatatypeRestriction); }
@Override public O visit(OWLDatatypeRestriction node) { return doDefault(node); }
@Override public void visit(OWLDatatypeRestriction node) { handleDefault(node); }
@Override public void visit(OWLDatatypeRestriction node) { type = DATA_TYPE_INDEX_BASE + 6; }
@Override public void visit(OWLDatatypeRestriction node) { hashCode = primes[54]; hashCode = hashCode * MULT + node.getDatatype().hashCode(); hashCode = hashCode * MULT + node.getFacetRestrictions().hashCode(); }
public Object visit(OWLDatatypeRestriction node) { profileViolations.add(new UseOfIllegalDataRange(getCurrentOntology(), getCurrentAxiom(), node)); return null; }
@Override protected void writeObject(OWLDatatypeRestriction object, BinaryOWLOutputStream outputStream) throws IOException { outputStream.writeOWLObject(object.getDatatype()); outputStream.writeOWLObjects(object.getFacetRestrictions()); }
@Override protected OWLDatatypeRestriction readObject(BinaryOWLInputStream inputStream) throws IOException, BinaryOWLParseException { OWLDatatype datatype = inputStream.readOWLObject(); Set<OWLFacetRestriction> facetRestrictions = inputStream.readOWLObjects(); return inputStream.getDataFactory().getOWLDatatypeRestriction(datatype, facetRestrictions); }