Package edu.stanford.smi.protegex.owl.model

Examples of edu.stanford.smi.protegex.owl.model.RDFSNamedClass


      List<IResult> result = new ArrayList<IResult>();
    Collection asserted = new ArrayList(cls.getNamedSuperclasses());
        Collection inferred = new ArrayList(inferredClasses);
        removeDuplicates(asserted, inferred);
        for (Iterator ait = asserted.iterator(); ait.hasNext();) {
            RDFSNamedClass superCls = (RDFSNamedClass) ait.next();
            if (!superCls.isMetaclass()) {
              result.add(new PResult(cls,IResult.REMOVE+op,superCls,ontology));
            }
        }
        for (Iterator ait = inferred.iterator(); ait.hasNext();) {
            RDFSNamedClass superCls = (RDFSNamedClass) ait.next();
            if (!superCls.isMetaclass()) {
                result.add(new PResult(cls,IResult.ADD+op,superCls,ontology));
            }
        }
        return result;
    }
View Full Code Here


      List<IResult> result = new ArrayList<IResult>();
    Collection asserted = new ArrayList(cls.getNamedSuperclasses());
        Collection inferred = new ArrayList(inferredClasses);
        removeDuplicates(asserted, inferred);
        for (Iterator ait = asserted.iterator(); ait.hasNext();) {
            RDFSNamedClass superCls = (RDFSNamedClass) ait.next();
            if (!superCls.isMetaclass()) {
              result.add(new PResult(cls,IResult.REMOVE+op,superCls,ontology));
            }
        }
        for (Iterator ait = inferred.iterator(); ait.hasNext();) {
            RDFSNamedClass superCls = (RDFSNamedClass) ait.next();
            if (!superCls.isMetaclass()) {
                result.add(new PResult(cls,IResult.ADD+op,superCls,ontology));
            }
        }
        return result;
    }
View Full Code Here

     
    }    
     

    private static RDFSNamedClass getLinearizationParentForType(RDFSNamedClass icdCategory, String type){
      RDFSNamedClass ret = null;
        Collection<RDFResource> linearizationSpecs = icdContentModel.getLinearizationSpecifications(icdCategory);
        for (RDFResource linearizationSpec : linearizationSpecs) {
            RDFResource linearization = (RDFResource) linearizationSpec.getPropertyValue(icdContentModel.getLinearizationViewProperty());
            RDFSNamedClass linearizationParent = (RDFSNamedClass) linearizationSpec.getPropertyValue(icdContentModel.getLinearizationParentProperty());
            Boolean isIncludedInLinearization = (Boolean) linearizationSpec.getPropertyValue(icdContentModel.getIsIncludedInLinearizationProperty());
           
            if(linearization.getBrowserText().equals(type)){
              ret = linearizationParent;
              break;
View Full Code Here

    @SuppressWarnings("deprecation")
    public RDFSNamedClass createICDCategory(String name, Collection<String> superclsesName) {
        if (name == null) {
            //name = IDGenerator.getNextUniqueId();//Guoqian
        }
        RDFSNamedClass cls = getICDClass(name, true);

        Collection<RDFSNamedClass> superclses = new ArrayList<RDFSNamedClass>();

        //we could treat also the case when a class has an external cause and another normal disease as parents..
        boolean isExternalCause = false;

        if (superclsesName == null || superclsesName.size() == 0) {
            superclses.add(getICDCategoryClass());
        } else {
            for (String superclsName : superclsesName) {
                RDFSNamedClass supercls = getICDSuperclass(superclsName, true);
                if (supercls != null) {
                    superclses.add(supercls);
                    //add superclasses
                    if (!cls.getSuperclasses(true).contains(supercls)) {
                        cls.addSuperclass(supercls);
                        if (cls.hasDirectSuperclass(owlModel.getOWLThingClass())) {
                            cls.removeSuperclass(owlModel.getOWLThingClass());
                        }
                    }
                    if (supercls.equals(getExternalCausesTopClass()) || supercls.hasSuperclass(getExternalCausesTopClass())) {
                        isExternalCause = true;
                    }
                }
            }
        }

        //set metaclasses
        cls.setDirectTypes(isExternalCause ? getExternalCauseMetaclasses() : getRegularDiseaseMetaclasses());

        RDFSNamedClass singleParent = superclses.size() > 1 ? null : CollectionUtilities.getFirstItem(superclses);

        //add linearization instances
        for (RDFResource linView : getLinearizationValueSet()) {
            RDFResource linSpec = getLinearizationSpecificationClass().createInstance(null); //IDGenerator.getNextUniqueId());//Guoqian
            linSpec.setPropertyValue(getLinearizationViewProperty(), linView);
View Full Code Here

    }


    @SuppressWarnings("deprecation")
    private RDFSNamedClass getICDSuperclass(String name, boolean create) {
        RDFSNamedClass cls = getICDClass(name, create);
        if (cls != null) {
            cls.setDirectTypes(getRegularDiseaseMetaclasses());
        }
        return cls;
    }
View Full Code Here

     * @param name - name of the class to be retrieved or created
     * @param create - true to create class if it doesn't exit
     * @return - the class
     */
    private RDFSNamedClass getICDClass(String name, boolean create) {
        RDFSNamedClass cls = owlModel.getRDFSNamedClass(name);
        if (cls == null && create) {
            cls = owlModel.createOWLNamedClass(name);
            cls.addSuperclass(owlModel.getOWLThingClass());
        }
        return cls;
    }
View Full Code Here

   
    public static void getChapterNodes(){
      Collection chapterNodes = new ArrayList();
      chapterNodes = icdContentModel.getICDCategoryClass().getSubclasses(false);
    for(Iterator it = chapterNodes.iterator(); it.hasNext(); ){
      RDFSNamedClass icdChaptetNode = (RDFSNamedClass) it.next();
      String chapterCode = getRDFSClassCode(icdChaptetNode);
     
      if(chapterCode.equals("TBD")){
        Collection directSubclses = icdChaptetNode.getSubclasses(false);
        Collection indirectSubclses = icdChaptetNode.getSubclasses(true);
        System.out.println("chapterCode:" + chapterCode + "|" + icdChaptetNode.getBrowserText());
        System.out.println("NumDirect:" + directSubclses.size() + "|NumIndirect" + indirectSubclses.size());
       
       
      }
     
View Full Code Here

        Collection<RDFSNamedClass> icdCategories = icdContentModel.getICDCategories();
        System.out.println("ICD Categories count: " + icdCategories.size() + " in time: " + ((System.currentTimeMillis() - t0)/1000) + " sec");
    }

    public static void getCategoryDetails() {
        RDFSNamedClass category = icdContentModel.getICDCategory("http://who.int/icd#Class_2751");
        System.out.println("Displayed as in the tree: " + category.getBrowserText());

        RDFResource defTerm = icdContentModel.getTerm(category, icdContentModel.getDefinitionProperty());
        if (defTerm != null) {
            String definition = (String) defTerm.getPropertyValue(icdContentModel.getLabelProperty());
View Full Code Here

        Collection<RDFResource> prefilledDefsTerm = icdContentModel.getTerms(category, icdContentModel.getPrefilledDefinitionProperty());
        System.out.println("\nPrefilled defintion terms: " + prefilledDefsTerm);
    }

    public static void getChildren() {
        RDFSNamedClass category = icdContentModel.getICDCategory("http://who.int/icd#H34.2");
        Collection children =  icdContentModel.getChildren(category);
        for(Iterator it = children.iterator(); it.hasNext();){
          RDFSNamedClass child = (RDFSNamedClass) it.next();
            System.out.println("Children of " + category.getURI() + " : " + child.getBrowserText() + " : " + child.getName());
                     
        }
   }
View Full Code Here

                     
        }
   }
   
    public static void getParent() {
        RDFSNamedClass category = icdContentModel.getICDCategory("http://who.int/icd#H34.2");
        System.out.println("Parent of " + category.getBrowserText() + " : " + category.getSuperclasses(false));
    }
View Full Code Here

TOP

Related Classes of edu.stanford.smi.protegex.owl.model.RDFSNamedClass

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.