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

Generate owl:equivalentClass triples #41

Open
nleguillarme opened this issue Mar 18, 2022 · 8 comments
Open

Generate owl:equivalentClass triples #41

nleguillarme opened this issue Mar 18, 2022 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@nleguillarme
Copy link

nleguillarme commented Mar 18, 2022

Hi,
As part of my knowledge graph creation process, I have some data in a csv file I need to transform into owl:equivalentClass triples.
My data basically consists of two columns, one with the subject IRI, the second with the object IRI, and I want to generate triples of the form (subject_iri, owl:equivalentClass, object_iri).
It does not seem possible, as mapeathor treats each subject as individuals. Here, my subjects are classes.
Am I right ?

@anaigmo
Copy link
Member

anaigmo commented Mar 18, 2022

Interesting point. I think yes, but by definition I think all mappings in [R2]RML create always subjects as instances. Please show an example if you have found a way to do it. I'm thinking, maybe, deleting the rr:class and in a POM stating that is an owl:class?

Anyway, this issue is more related to what RML and R2RML can represent. The only problem I can see that addresses Mapeathor if it forces the user to specify a rr:class for the subject. I meant, please check first if this can be done and correctly processed by an [R2]RML-processor, and if so, I'll see if it affects the current behaviour of Mapeathor, because right now I'm not sure if it is affected.

@nleguillarme
Copy link
Author

Here is how I do it in YARRRML:

SRCTAXON:
    sources:
      - access: ./taxon.tsv
        referenceFormulation: csv
        delimiter: "\t"
    s: $(src_iri)
    po:
      - p: owl:equivalentClass
        o:
          mapping: TGTTAXON
          condition:
            function: equal
            parameters:
              - [str1, $(ID)]
              - [str2, $(ID)]

This generates the following RML rules

:rules_000 void:exampleResource :map_SRCTAXON_000.
:map_SRCTAXON_000 rml:logicalSource :source_004.
:source_004 a rml:LogicalSource;
    rml:source :csvw_004.
:csvw_004 a csvw:Table;
    csvw:url "./taxon.tsv";
    csvw:dialect :csvw-dialect_004.
:csvw-dialect_004 a csvw:Dialect;
    csvw:delimiter "\t".
:source_004 rml:referenceFormulation ql:CSV.
:map_SRCTAXON_000 a rr:TriplesMap;
    rdfs:label "SRCTAXON".
:s_004 a rr:SubjectMap.
:map_SRCTAXON_000 rr:subjectMap :s_004.
:s_004 rml:reference "src_iri".
:pom_010 a rr:PredicateObjectMap.
:map_SRCTAXON_000 rr:predicateObjectMap :pom_010.
:pm_010 a rr:PredicateMap.
:pom_010 rr:predicateMap :pm_010.
:pm_010 rr:constant owl:equivalentClass.
:pom_010 rr:objectMap :om_010.

@anaigmo
Copy link
Member

anaigmo commented Apr 8, 2022

I see, I've been running tests and mapeathor creates "rr:class nan" when provided with no class, so that should be changed in order to address your use case, the rest (I think) is fine. Tagging for modification

@anaigmo anaigmo self-assigned this Apr 8, 2022
@anaigmo anaigmo added the enhancement New feature or request label Apr 8, 2022
@anaigmo
Copy link
Member

anaigmo commented Apr 8, 2022

The new release v1.5.4 can create a subject with no class, I hope it works for you now!

@anaigmo anaigmo closed this as completed Apr 8, 2022
@nleguillarme
Copy link
Author

Hi @anaigmo, subject with no class creation works for me, thank you !
However, I still lack the possibility of specifying that the URI I read in my source file is a IRI -> the subject is recognized as a BlankNode. Would it be possible to add a "IsIRI" column in the Subject tab, so that if I set Class to empty and IsIRI to true, mapeathor recognized that my subject is a class ?

@anaigmo
Copy link
Member

anaigmo commented Apr 21, 2022

I'm glad that works :)

I'm re-opening the issue for the additional column issue. Could you provide an example of the IRI that is recognized as BN? So I can see why it behaving like this. I'd like to avoid adding more columns when possible, so first I want to check if it is possible to distinguish IRI/BN in all cases. Thanks!

@anaigmo anaigmo reopened this Apr 21, 2022
@nleguillarme
Copy link
Author

nleguillarme commented Apr 21, 2022

Here are a few examples

iri queryIRI
https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=288551 https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=288551
http://www.gbif.org/species/2280552  https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=288551

I would like to be able to create owl:equivalentClass triples between elements in the iri and queryIRI columns

@nleguillarme nleguillarme changed the title Generate owl:sameAs triples Generate owl:equivalentClass triples Mar 31, 2023
@nleguillarme
Copy link
Author

Hi, I just realized that what I meant all along was not to generate owl:sameAs triples but owl:equivalentClass triples (to indicate that two classes are equivalent). I have changed all my previous posts to reflect this.

I am still interested in creating triples relating classes (and not individuals).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants