Package org.semanticweb.owl.model

Examples of org.semanticweb.owl.model.OWLDescription


    return atoms;
  }

  public void visit(SWRLClassAtom atom) {
    OWLDescription c = atom.getPredicate();

    SWRLAtomIObject v = atom.getArgument();
    v.accept( this );

    AtomIObject subj = swrlIObject;

    c.accept( this );
    swrlAtom = new ClassAtom( term, subj );
  }
View Full Code Here


    OWLPropertyExpression<?,?> prop = (OWLPropertyExpression<?,?>) obj;

    visit( (ATermAppl) term.getArgument( 1 ) );

    if( prop instanceof OWLObjectPropertyExpression ) {
      OWLDescription desc = (OWLDescription) obj;

      obj = factory.getOWLObjectSomeRestriction( (OWLObjectPropertyExpression) prop, desc );
    }
    else {
      OWLDataRange datatype = (OWLDataRange) obj;
View Full Code Here

    OWLPropertyExpression<?,?> prop = (OWLPropertyExpression<?,?>) obj;

    visit( (ATermAppl) term.getArgument( 1 ) );

    if( prop instanceof OWLObjectPropertyExpression ) {
      OWLDescription desc = (OWLDescription) obj;

      obj = factory.getOWLObjectAllRestriction( (OWLObjectPropertyExpression) prop, desc );
    }
    else {
      OWLDataRange datatype = (OWLDataRange) obj;
View Full Code Here

    OWLPropertyExpression<?,?> prop = (OWLPropertyExpression<?,?>) obj;

    int cardinality = Integer.parseInt( term.getArgument( 1 ).toString() );

    if( prop instanceof OWLObjectPropertyExpression ) {
      OWLDescription c = (OWLDescription) convert( (ATermAppl) term.getArgument( 2 ) );
      obj = factory.getOWLObjectMinCardinalityRestriction( (OWLObjectPropertyExpression) prop,
          cardinality, c );
    }
    else {
      OWLDataRange d = (OWLDataRange) convert( (ATermAppl) term.getArgument( 2 ) );
View Full Code Here

    OWLPropertyExpression<?,?> prop = (OWLPropertyExpression<?,?>) obj;

    int cardinality = Integer.parseInt( term.getArgument( 1 ).toString() );

    if( prop instanceof OWLObjectPropertyExpression ) {
      OWLDescription c = (OWLDescription) convert( (ATermAppl) term.getArgument( 2 ) );
      obj = factory.getOWLObjectExactCardinalityRestriction( (OWLObjectPropertyExpression) prop,
          cardinality, c );
    }
    else {
      OWLDataRange d = (OWLDataRange) convert( (ATermAppl) term.getArgument( 2 ) );
View Full Code Here

    OWLPropertyExpression<?,?> prop = (OWLPropertyExpression<?,?>) obj;

    int cardinality = Integer.parseInt( term.getArgument( 1 ).toString() );

    if( prop instanceof OWLObjectPropertyExpression ) {
      OWLDescription c = (OWLDescription) convert( (ATermAppl) term.getArgument( 2 ) );
      obj = factory.getOWLObjectMaxCardinalityRestriction( (OWLObjectPropertyExpression) prop,
          cardinality, c );
    }
    else {
      OWLDataRange d = (OWLDataRange) convert( (ATermAppl) term.getArgument( 2 ) );
View Full Code Here

  public OWLAxiom convert(ATermAppl term) {
    OWLAxiom axiom = null;

    if( term.getAFun().equals( ATermUtils.EQCLASSFUN ) ) {
      OWLDescription c1 = (OWLDescription) conceptConverter.convert( (ATermAppl) term
          .getArgument( 0 ) );
      OWLDescription c2 = (OWLDescription) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );

      Set<OWLDescription> descriptions = new HashSet<OWLDescription>();
      descriptions.add( c1 );
      descriptions.add( c2 );

      if( c1 != null && c2 != null )
        axiom = factory.getOWLEquivalentClassesAxiom( descriptions );
    }
    else if( term.getAFun().equals( ATermUtils.SUBFUN ) ) {
      OWLDescription c1 = (OWLDescription) conceptConverter.convert( (ATermAppl) term
          .getArgument( 0 ) );
      OWLDescription c2 = (OWLDescription) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );

      if( c1 != null && c2 != null )
        axiom = factory.getOWLSubClassAxiom( c1, c2 );
    }
    else if( term.getAFun().equals( ATermUtils.DISJOINTSFUN ) ) {
      Set<OWLDescription> descriptions = new HashSet<OWLDescription>();

      ATermList concepts = (ATermList) term.getArgument( 0 );
      for( ; !concepts.isEmpty(); concepts = concepts.getNext() ) {
        ATermAppl concept = (ATermAppl) concepts.getFirst();
        OWLDescription c = (OWLDescription) conceptConverter.convert( concept );
        if( c == null )
          break;

        descriptions.add( c );
      }

      // if no error occurred list will be empty
      if( concepts.isEmpty() )
        axiom = factory.getOWLDisjointClassesAxiom( descriptions );
    }
    else if( term.getAFun().equals( ATermUtils.DISJOINTFUN ) ) {
      OWLDescription c1 = (OWLDescription) conceptConverter.convert( (ATermAppl) term
          .getArgument( 0 ) );
      OWLDescription c2 = (OWLDescription) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );

      Set<OWLDescription> descriptions = new HashSet<OWLDescription>();
      descriptions.add( c1 );
      descriptions.add( c2 );

      if( c1 != null && c2 != null )
        axiom = factory.getOWLDisjointClassesAxiom( descriptions );
    }
    else if( term.getAFun().equals( ATermUtils.DISJOINTPROPSFUN ) ) {
      // Set<OWLProperty<?,?>> properties = new
      // HashSet<OWLProperty<?,?>>();
      Set properties = new HashSet();

      Boolean isObjectProps = null;
      ATermList props = (ATermList) term.getArgument( 0 );
      for( ; !props.isEmpty(); props = props.getNext() ) {
        OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );
        if( p == null )
          break;
        boolean isObjectProp = p instanceof OWLObjectProperty;
        if( !isObjectProp && !(p instanceof OWLDataProperty) )
          break;
        if( isObjectProps == null )
          isObjectProps = isObjectProp;
        else if( isObjectProps != isObjectProp )
          break;

        properties.add( (OWLProperty<?, ?>) p );
      }

      // if no error occurred list will be empty
      if( props.isEmpty() ) {
        if( isObjectProps )
          axiom = factory
              .getOWLDisjointObjectPropertiesAxiom( (Set<? extends OWLObjectPropertyExpression>) properties );
        else
          axiom = factory
              .getOWLDisjointDataPropertiesAxiom( (Set<? extends OWLDataPropertyExpression>) properties );
      }
    }
    else if( term.getAFun().equals( ATermUtils.DISJOINTPROPFUN ) ) {
      OWLObject p1 = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );
      OWLObject p2 = conceptConverter.convert( (ATermAppl) term.getArgument( 1 ) );

      if( p1 != null && p2 != null ) {
        if( p1 instanceof OWLObjectProperty && p2 instanceof OWLObjectProperty )
          axiom = factory.getOWLDisjointObjectPropertiesAxiom( SetUtils.create(
              (OWLObjectProperty) p1, (OWLObjectProperty) p2 ) );
        else if( p1 instanceof OWLDataProperty && p2 instanceof OWLDataProperty )
          axiom = factory.getOWLDisjointDataPropertiesAxiom( SetUtils.create(
              (OWLDataProperty) p1, (OWLDataProperty) p2 ) );
      }
    }
    else if( term.getAFun().equals( ATermUtils.SUBPROPFUN ) ) {
      if( term.getArgument( 0 ) instanceof ATermList ) {
        List<OWLObjectPropertyExpression> subs = new ArrayList<OWLObjectPropertyExpression>();
        for( ATermList list = (ATermList) term.getArgument( 0 ); !list.isEmpty(); list = list
            .getNext() ) {
          OWLObjectPropertyExpression p = (OWLObjectPropertyExpression) conceptConverter
              .convert( (ATermAppl) list.getFirst() );
          if( p == null ) {
            subs = null;
            break;
          }
          subs.add( p );
        }
        OWLObjectProperty sup = (OWLObjectProperty) conceptConverter
            .convert( (ATermAppl) term.getArgument( 1 ) );

        if( subs != null && sup != null ) {
          axiom = factory.getOWLObjectPropertyChainSubPropertyAxiom( subs, sup );
        }
      }
      else {
        OWLObject p1 = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );
        OWLObject p2 = conceptConverter.convert( (ATermAppl) term.getArgument( 1 ) );

        if( p1 != null && p2 != null ) {
          if( p1 instanceof OWLObjectPropertyExpression && p2 instanceof OWLObjectPropertyExpression )
            axiom = factory.getOWLSubObjectPropertyAxiom( (OWLObjectPropertyExpression) p1,
                (OWLObjectPropertyExpression) p2 );
          else if( p1 instanceof OWLDataProperty && p2 instanceof OWLDataProperty )
            axiom = factory.getOWLSubDataPropertyAxiom( (OWLDataProperty) p1,
                (OWLDataProperty) p2 );
        }
      }
    }
    else if( term.getAFun().equals( ATermUtils.EQPROPFUN ) ) {
      OWLObject p1 = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );
      OWLObject p2 = conceptConverter.convert( (ATermAppl) term.getArgument( 1 ) );

      if( p1 != null && p2 != null ) {
        if( p1 instanceof OWLObjectProperty && p2 instanceof OWLObjectProperty )
          axiom = factory.getOWLEquivalentObjectPropertiesAxiom( SetUtils.create(
              (OWLObjectProperty) p1, (OWLObjectProperty) p2 ) );
        else if( p1 instanceof OWLDataProperty && p2 instanceof OWLDataProperty )
          axiom = factory.getOWLEquivalentDataPropertiesAxiom( SetUtils.create(
              (OWLDataProperty) p1, (OWLDataProperty) p2 ) );
      }
    }
    else if( term.getAFun().equals( ATermUtils.DOMAINFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );
      OWLDescription c = (OWLDescription) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );

      if( c != null && p != null ) {
        if( p instanceof OWLObjectProperty )
          axiom = factory.getOWLObjectPropertyDomainAxiom(
              (OWLObjectPropertyExpression) p, c );
        else
          axiom = factory
              .getOWLDataPropertyDomainAxiom( (OWLDataPropertyExpression) p, c );
      }
    }
    else if( term.getAFun().equals( ATermUtils.RANGEFUN ) ) {
      OWLPropertyRange e = (OWLPropertyRange) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );
      if( e != null ) {
        if( e instanceof OWLDescription ) {
          OWLObjectProperty p = (OWLObjectProperty) conceptConverter
              .convert( (ATermAppl) term.getArgument( 0 ) );
          if( p != null )
            axiom = factory.getOWLObjectPropertyRangeAxiom( p, (OWLDescription) e );
        }
        else {
          OWLDataProperty p = (OWLDataProperty) conceptConverter
              .convert( (ATermAppl) term.getArgument( 0 ) );
          if( p != null )
            axiom = factory.getOWLDataPropertyRangeAxiom( p, (OWLDataRange) e );
        }
      }
    }
    else if( term.getAFun().equals( ATermUtils.INVPROPFUN ) ) {
      OWLObjectProperty p1 = (OWLObjectProperty) conceptConverter.convert( (ATermAppl) term
          .getArgument( 0 ) );
      OWLObjectProperty p2 = (OWLObjectProperty) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );

      if( p1 != null && p2 != null )
        axiom = factory.getOWLInverseObjectPropertiesAxiom( p1, p2 );
    }
    else if( term.getAFun().equals( ATermUtils.TRANSITIVEFUN ) ) {
      OWLObjectProperty p = (OWLObjectProperty) conceptConverter.convert( (ATermAppl) term
          .getArgument( 0 ) );

      if( p != null )
        axiom = factory.getOWLTransitiveObjectPropertyAxiom( p );
    }
    else if( term.getAFun().equals( ATermUtils.FUNCTIONALFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );

      if( p != null ) {
        if( p instanceof OWLObjectProperty )
          axiom = factory
              .getOWLFunctionalObjectPropertyAxiom( (OWLObjectPropertyExpression) p );
        else if( p instanceof OWLDataProperty )
          axiom = factory
              .getOWLFunctionalDataPropertyAxiom( (OWLDataPropertyExpression) p );
      }
    }
    else if( term.getAFun().equals( ATermUtils.INVFUNCTIONALFUN ) ) {
      OWLObjectProperty p = (OWLObjectProperty) conceptConverter.convert( (ATermAppl) term
          .getArgument( 0 ) );

      if( p != null )
        axiom = factory.getOWLInverseFunctionalObjectPropertyAxiom( p );
    }
    else if( term.getAFun().equals( ATermUtils.SYMMETRICFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );

      if( p != null && p instanceof OWLObjectPropertyExpression )
        axiom = factory
            .getOWLSymmetricObjectPropertyAxiom( (OWLObjectPropertyExpression) p );
    }
    else if( term.getAFun().equals( ATermUtils.ASYMMETRICFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );

      if( p != null && p instanceof OWLObjectPropertyExpression )
        axiom = factory
            .getOWLAntiSymmetricObjectPropertyAxiom( (OWLObjectPropertyExpression) p );
    }
    else if( term.getAFun().equals( ATermUtils.REFLEXIVEFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );

      if( p != null && p instanceof OWLObjectPropertyExpression )
        axiom = factory
            .getOWLReflexiveObjectPropertyAxiom( (OWLObjectPropertyExpression) p );
    }
    else if( term.getAFun().equals( ATermUtils.IRREFLEXIVEFUN ) ) {
      OWLObject p = conceptConverter.convert( (ATermAppl) term.getArgument( 0 ) );

      if( p != null && p instanceof OWLObjectPropertyExpression )
        axiom = factory
            .getOWLIrreflexiveObjectPropertyAxiom( (OWLObjectPropertyExpression) p );
    }
    else if( term.getAFun().equals( ATermUtils.TYPEFUN ) ) {
      OWLIndividual i = (OWLIndividual) conceptConverter.convert( (ATermAppl) term
          .getArgument( 0 ) );
      OWLDescription c = (OWLDescription) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );

      if( i != null && c != null )
        axiom = factory.getOWLClassAssertionAxiom( i, c );
    }
View Full Code Here

    if( term.getAFun().equals( ATermUtils.TYPEFUN ) ) {
      ATermAppl i = (ATermAppl) term.getArgument( 0 );
      SWRLAtomIObject io = parseToAtomIObject( i );

      OWLDescription c = (OWLDescription) conceptConverter.convert( (ATermAppl) term
          .getArgument( 1 ) );

      atom = factory.getSWRLClassAtom( c, io );
    }
    else if( term.getAFun().equals( ATermUtils.PROPFUN ) ) {
View Full Code Here

    renderer = new ConciseExplanationRenderer();
  }

  public void testExplanations(OWLAxiom axiom, int max, Set<Set<OWLAxiom>> expectedExplanations)
      throws Exception {
    OWLDescription unsatClass = converter.convert( axiom );

    if( log.isLoggable( Level.FINE ) )
      log.fine( "Axiom " + (++axiomCount) + ": " + axiom + " Expecting "
          + expectedExplanations.size() + " explanations" );
View Full Code Here

TOP

Related Classes of org.semanticweb.owl.model.OWLDescription

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.