Package edu.stanford.smi.protege.model

Examples of edu.stanford.smi.protege.model.Instance


    }

    public void addRdfsLabel(RDFSNamedClass cls) {
        try {
            String code = (String) cls.getPropertyValue(getIcdCodeProperty());
            Instance titleInst = (Instance) cls.getPropertyValue(getIcdTitleProperty());
            String title = (String) titleInst.getOwnSlotValue(getLabelProperty());
            cls.addLabel(code + ". " + title, null);
        } catch (Exception e) {
            log.log(Level.WARNING, "Could not set rdfs:label for " + cls);
        }
    }
View Full Code Here


        OWLAPIMetaProjectStore.getStore().saveMetaProject(mpm);
    }

    private void migrateProjectInstance(KnowledgeBase kb, ProjectInstance pi) {
        LOGGER.info("Processing " + pi.getName());
        final Instance protegeInstance = pi.getProtegeInstance();
        final String existingName = pi.getName();

        final Slot displayNameSlot = kb.getSlot(DISPLAY_NAME_SLOT_NAME);
        protegeInstance.setOwnSlotValue(displayNameSlot, existingName);

        final ProjectId newProjectId = ProjectIdFactory.getFreshProjectId();
        pi.setName(newProjectId.getId());
        moveProjectDirectoryOnDisk(existingName, newProjectId);
    }
View Full Code Here

    public boolean isInTrash(ProjectId projectId) {
        try {
            READ_LOCK.lock();
            ProjectInstance pi = getProjectInstance(projectId);
            Instance instance = pi.getProtegeInstance();
            KnowledgeBase knowledgeBase = instance.getKnowledgeBase();
            Slot inTrashSlot = knowledgeBase.getSlot(IN_TRASH_SLOT_NAME);
            if(inTrashSlot == null) {
                return false;
            }
            Object val = instance.getOwnSlotValue(inTrashSlot);
            if(!(val instanceof Boolean)) {
                return false;
            }
            return (Boolean) val;
        }
View Full Code Here

    public void setInTrash(ProjectId projectId, boolean b) {
        try {
            WRITE_LOCK.lock();
            ProjectInstance pi = getProjectInstance(projectId);
            Instance instance = pi.getProtegeInstance();
            KnowledgeBase knowledgeBase = instance.getKnowledgeBase();
            Slot inTrashSlot = knowledgeBase.getSlot(IN_TRASH_SLOT_NAME);
            if (inTrashSlot != null) {
                instance.setOwnSlotValue(inTrashSlot, b);
            }
            save();
        }
        finally {
            WRITE_LOCK.unlock();
View Full Code Here

            Group group = groupOperation.getAllowedGroup();
            if (group.getName().equalsIgnoreCase(OntologyShareAccessConstants.WORLD_GROUP_NAME) && groupOperation.getAllowedOperations().contains(operation)) {
                groupOperations.remove(groupOperation);
                projectInstance.setAllowedGroupOperations(groupOperations);

                Instance groupOpInst1 = (((WrappedProtegeInstanceImpl) groupOperation).getProtegeInstance());
                Instance cloneGroupOpInst = (Instance) groupOpInst1.shallowCopy(null, null);

                GroupOperation cloneGroupOp = new GroupOperationImpl((MetaProjectImpl) projectInstance.getMetaProject(), cloneGroupOpInst);
                Set<Operation> cloneGroupAllowedOp = cloneGroupOp.getAllowedOperations();
                for (Operation op : cloneGroupAllowedOp) {
                    if (op.equals(operation)) {
View Full Code Here

     */
    private void addProjectToMetaProject(ProjectId projectId, NewProjectSettings newProjectSettings) {
        MetaProject mp = getMetaProject();
        ProjectInstance pi = mp.createProject(projectId.getId());
        pi.setDescription(newProjectSettings.getProjectDescription());
        final Instance protegeInstance = pi.getProtegeInstance();
        final KnowledgeBase kb = protegeInstance.getKnowledgeBase();
        final Slot displayNameSlot = kb.getSlot("displayName");
        protegeInstance.setOwnSlotValue(displayNameSlot, newProjectSettings.getDisplayName());
        User user = mp.getUser(newProjectSettings.getProjectOwner().getUserName());
        pi.setOwner(user);
        OWLAPIMetaProjectStore.getStore().saveMetaProject(this);
    }
View Full Code Here

        }
        return inTrashSlot;
    }

    private static boolean isInTrash(ProjectInstance projectInstance) {
        Instance protegeInstance = projectInstance.getProtegeInstance();
        KnowledgeBase kb = protegeInstance.getKnowledgeBase();
        Slot inTrashSlot = getInTrashSlot(kb);
        Object ownSlotValue = protegeInstance.getOwnSlotValue(inTrashSlot);
        return ownSlotValue != null && ownSlotValue.equals(Boolean.TRUE);
    }
View Full Code Here

TOP

Related Classes of edu.stanford.smi.protege.model.Instance

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.