Changeset 117


Ignore:
Timestamp:
Dec 2, 2009, 1:40:52 PM (8 years ago)
Author:
martin
Message:

References #6 Annotation value is also attached to each annotated value.

Location:
trunk/OMOdb/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/OMOdb/src/core/se/lu/thep/omodb/loader/parser/owl/OWLParser.java

    r116 r117  
    3939import org.semanticweb.owl.model.OWLAnnotationAxiom;
    4040import org.semanticweb.owl.model.OWLClass;
     41import org.semanticweb.owl.model.OWLConstant;
    4142import org.semanticweb.owl.model.OWLDataProperty;
    4243import org.semanticweb.owl.model.OWLDataPropertyExpression;
     
    4647import org.semanticweb.owl.model.OWLDescription;
    4748import org.semanticweb.owl.model.OWLIndividual;
     49import org.semanticweb.owl.model.OWLNamedObject;
     50import org.semanticweb.owl.model.OWLObject;
    4851import org.semanticweb.owl.model.OWLObjectAllRestriction;
    4952import org.semanticweb.owl.model.OWLObjectComplementOf;
     
    560563                return property;
    561564        }
    562        
    563 //     
    564 //      private DataProperty getPropertyFromRestriction(
    565 //                      Session session, OWLRestriction<OWLDataPropertyExpression> restriction, Ontology ont)
    566 //      {
    567 //              String uriString = restriction.getProperty().asOWLDataProperty().getURI().toString();
    568 //              DataProperty property = OwlUtil.getExistingOrNewComponent(session, ont, DataProperty.class, uriString);
    569 //              return property;
    570 //      }
    571        
    572        
     565
    573566        @SuppressWarnings("unchecked")
    574567        private void renderAnnotations(Session session, Set<OWLAnnotationAxiom> annotationAxioms, Ontology ontology, OntologyElement element)
     
    578571                        OWLAnnotation owlAnnotation = annotationAxiom.getAnnotation();
    579572                        URI annotationUri = owlAnnotation.getAnnotationURI();
    580                         Annotation a = new Annotation(ontology, annotationUri.toString(), annotationUri.getFragment());
     573                        OWLObject valueObject = owlAnnotation.getAnnotationValue();
     574                        Annotation a = new Annotation(ontology, annotationUri.toString(), annotationUri.getFragment());
     575                       
    581576                        a.setOwner(element);
    582577                        session.save(a);
     578                       
     579                        if (owlAnnotation.isAnnotationByConstant())
     580                        {
     581                                OWLConstant owlConstant = (OWLConstant)valueObject;
     582                                a.setStringValue(owlConstant.getLiteral());
     583                        }
     584                        else if (owlAnnotation.getAnnotationValue() instanceof OWLIndividual)
     585                        {
     586                                URI valueUri = ((OWLNamedObject)valueObject).getURI();
     587                                Individual dbIndividual = OwlUtil.getExistingOrNewComponent(session, ontology, Individual.class, valueUri.toString());
     588                                a.setIndividualValue(dbIndividual);
     589                        }
     590                        else
     591                        {
     592                                System.out.println(owlAnnotation.getAnnotationValue().getClass());
     593                        }
    583594                }
    584595        }
  • trunk/OMOdb/src/core/se/lu/thep/omodb/model/Annotation.java

    r116 r117  
    3333import org.hibernate.Session;
    3434import org.hibernate.annotations.Any;
     35import org.hibernate.annotations.Index;
    3536/**
    3637        The definition of meta data for those columns that holds
     
    5960public class Annotation extends Component
    6061{
    61         @Column(name="string_value")
     62        @Column(name="string_value", length=65535)
    6263        private String stringValue;
    6364       
  • trunk/OMOdb/src/test/se/lu/thep/omodb/test/loader/parser/owl/OWLParserTest.java

    r116 r117  
    5151                throws OWLOntologyCreationException
    5252        {
    53                 String uriString = ClassLoader.getSystemResource("wine.owl").toString();
     53                String uriString = ClassLoader.getSystemResource("MGEDOntology.owl").toString();
    5454                OWLParser rend = new OWLParser();
    5555                rend.render(uriString);
Note: See TracChangeset for help on using the changeset viewer.