Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getObjectLabel does not work (not returning simple concepts) #25

Open
boborova3 opened this issue Jun 26, 2022 · 0 comments
Open

getObjectLabel does not work (not returning simple concepts) #25

boborova3 opened this issue Jun 26, 2022 · 0 comments

Comments

@boborova3
Copy link

boborova3 commented Jun 26, 2022

Hello,
I was working with KnowledgeEplorer a bit and found some potential bugs in the method addC in the class KnowledgeExplorer.
I guess there should be p.getpName() instead of p.getId(), because p.getId() is always 0, thus everything is filtered out.

I do not know about the individual case, because it does not seem that label includes IndividualName but nominals, ObjectOfOne, so the synonyms are not added if there is an equal individual.

I was not sure if I should repair it and commit changes. I do not want to mess it up though.

I also published this issue on StackOverflow: https://stackoverflow.com/questions/72716584/jfact-knowledgeexplorer-getobjectlabel-does-not-return-simple-concepts

My suggested solution is:

private void addC(Expression e) {
        // check named concepts
        if (e instanceof ConceptName) {
            cs.get((ConceptName) e).stream().filter(p -> p.getpName() != 0)
                    .forEach(p -> concepts.add(d2i.getCExpr(p.getpName())));
            return;
        }

        // check named individuals
        if (e instanceof IndividualName) {
            is.get((IndividualName) e).forEach(p -> concepts.add(d2i.getCExpr(p.getpName())));
            return;
        }

        if (e instanceof ConceptOneOf) {
           List<IndividualName> list = ((ConceptOneOf) e).getArguments();
            for (IndividualName i : list) {
                is.get(i).stream()
                        .forEach(p -> concepts.add(d2i.getCExpr(p.getpName())));
            }
            return;
        }
        concepts.add(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant