Cellfie-plugin: How to refer to a Property

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Cellfie-plugin: How to refer to a Property

MihalyF
Dear Forum,

I need some help to express how to refer to a property in the Excel sheet
with the goal to populate a data or annotation property in the ontology.
Those properties are already defined in the target ontology.

Simplified case:
ColumnA: Property IRI
ColumnB: Value

I would like to create an individual from other columns and associate the
actual property from the columnA with the value from columnB

I appreciate any help.

Cheers,
Mihaly



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

Martin O'Connor-2
You could try something like:

Individual: @D1
  Facts: @A1 @B2  

Note that -- as with class and individual names -- the cells in column A here must contain the prefixed or short name of the OWL property; IRI-based names are not currently handled.

Martin


> On Nov 29, 2018, at 10:11 AM, MihalyF <[hidden email]> wrote:
>
> Dear Forum,
>
> I need some help to express how to refer to a property in the Excel sheet
> with the goal to populate a data or annotation property in the ontology.
> Those properties are already defined in the target ontology.
>
> Simplified case:
> ColumnA: Property IRI
> ColumnB: Value
>
> I would like to create an individual from other columns and associate the
> actual property from the columnA with the value from columnB
>
> I appreciate any help.
>
> Cheers,
> Mihaly
>
>
>
> --
> Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

MihalyF
Thank you Martin,

I did try your suggestion.

The only issue I've had with that solution, the assertion is resulted in an
error saying "The entity already exists: ...." and referring to the property
given in the columnA (this property either an existing Annotation or
DataProperty)

Does it mean that with that syntax, the plugin logic tries to create the
Property not just assert it?


Thanks,
Mihaly



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

Martin O'Connor-2
Strange. Pre-existing properties should be resolved seamlessly.

Can you send me an example spreadsheet, ontology, and mapping rule set and I can look at it.

(Also make sure you are using the latest Protege and Cellfie plugin.)

Martin

> On Nov 30, 2018, at 2:18 PM, MihalyF <[hidden email]> wrote:
>
> Thank you Martin,
>
> I did try your suggestion.
>
> The only issue I've had with that solution, the assertion is resulted in an
> error saying "The entity already exists: ...." and referring to the property
> given in the columnA (this property either an existing Annotation or
> DataProperty)
>
> Does it mean that with that syntax, the plugin logic tries to create the
> Property not just assert it?
>
>
> Thanks,
> Mihaly
>
>
>
> --
> Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

MihalyF
Hi Martin,

Here comes my examples. I'm using Protege 5.5 beta-5

Thanks for the effort

Cheers,
Mihaly

Cellfie-transformation01.json
<http://protege-project.136.n4.nabble.com/file/t376949/Cellfie-transformation01.json>  
core-test.ttl
<http://protege-project.136.n4.nabble.com/file/t376949/core-test.ttl>  
ProductsXT-test01.xlsx
<http://protege-project.136.n4.nabble.com/file/t376949/ProductsXT-test01.xlsx>  



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

Josef Hardi
Hi Mihaly,

If you have the property (or the class) already in the source ontology, it is required to mention it in the transformation rules, for example:
```
Individual: @D2(rdf:ID mm:prefix="pd")
Facts: P101011769 @D8
Types: P101011776
```

But if you insist to use your current transformation rule then start with an empty ontology and Cellfie will create the OWL entities that you refer in the spreadsheet. (PS: If you start with an empty ontology, you need to prep the ontology first by adding the necessary prefixes, i.e., pd: and rdl:)

Best,
Josef

> On Dec 3, 2018, at 4:43 AM, MihalyF <[hidden email]> wrote:
>
> Hi Martin,
>
> Here comes my examples. I'm using Protege 5.5 beta-5
>
> Thanks for the effort
>
> Cheers,
> Mihaly
>
> Cellfie-transformation01.json
> <http://protege-project.136.n4.nabble.com/file/t376949/Cellfie-transformation01.json>  
> core-test.ttl
> <http://protege-project.136.n4.nabble.com/file/t376949/core-test.ttl>  
> ProductsXT-test01.xlsx
> <http://protege-project.136.n4.nabble.com/file/t376949/ProductsXT-test01.xlsx>  
>
>
>
> --
> Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

MihalyF
Thanks Josef,

I'm a bit confused, the transformation rule I tried has the reference to the
existing properties lies in the souce file:

Individual: @D2(rdf:ID mm:prefix="pd")
Facts: @A8(rdf:ID) @D8
Types: @D3

I tried to replace the references with the specific IRIs as you suggested,
but got the same error "Entity already exits <IRI>"


Individual: @D2(rdf:ID mm:prefix="pd")
Facts: rdl:P101011769 @D8
Types: rdl:P101011776

It looks for me the plug-in insists to create the properties even if they
already exists insted of assert them into the ontology :( , could that be a
bug?

Using an empty ontology is unfortunately not a useful option, I need to
handel a few thousands assertions.

Cheers,
Mihaly




--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

Josef Hardi
Hi Mihaly,

After a bit of investigation, I’m going to revise my earlier answer. So this is the way your transformation rule should look like:
```
Individual: @D2(rdf:ID mm:prefix="pd")
Facts: @A8(ObjectProperty) @D8
Types: @D3
```

Now, the caveat is Protege must use the same rendering as the values shown in your spreadsheet, or in your case, the values are using prefixed names. To change this setting, go to the Protege menu bar and select ‘View > Render by prefixed name’. Reopen Cellfie and use the transformation rule above. It should work as expected.

Best,
Josef

> On Dec 6, 2018, at 6:29 AM, MihalyF <[hidden email]> wrote:
>
> Thanks Josef,
>
> I'm a bit confused, the transformation rule I tried has the reference to the
> existing properties lies in the souce file:
>
> Individual: @D2(rdf:ID mm:prefix="pd")
> Facts: @A8(rdf:ID) @D8
> Types: @D3
>
> I tried to replace the references with the specific IRIs as you suggested,
> but got the same error "Entity already exits <IRI>"
>
>
> Individual: @D2(rdf:ID mm:prefix="pd")
> Facts: rdl:P101011769 @D8
> Types: rdl:P101011776
>
> It looks for me the plug-in insists to create the properties even if they
> already exists insted of assert them into the ontology :( , could that be a
> bug?
>
> Using an empty ontology is unfortunately not a useful option, I need to
> handel a few thousands assertions.
>
> Cheers,
> Mihaly
>
>
>
>
> --
> Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

MihalyF
Thank you Josef, that works very well

I wonder if there is a way to refer to the type of owl entity instead of
specifying it explicitly in the transformation rule? I tried to replace
"ObjectProperty" simply with a Excel reference but it won't work.

Individual: @D2(rdf:ID mm:prefix="pd")
Facts: @A8(*@B8*) @D8
Types: @D3

It would make the rule very much generic and the source would be very
flexible to updates.

Another question, is it possible to only generate property assertions for an
existing individual?

Thanks again,
Mihaly



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

Martin O'Connor-2


> I wonder if there is a way to refer to the type of owl entity instead of
> specifying it explicitly in the transformation rule? I tried to replace
> "ObjectProperty" simply with a Excel reference but it won't work.
>
> Individual: @D2(rdf:ID mm:prefix="pd")
> Facts: @A8(*@B8*) @D8
> Types: @D3

The Mapping Master language only allows references clauses in positions where OWL entities (classes, properties, individuals, and datatypes) and literals can occur.

https://github.com/protegeproject/mapping-master/wiki/MappingMasterDSL#reference-resolution

While allowing reference clauses to occur in any position could be useful, it would complicate the language considerably.

> Another question, is it possible to only generate property assertions for an existing individual?

Property assertions can be generate for both existing and generated individuals.

For example, assuming cell A1 = ‘Fred’ and that there is no individual called ‘Fred’ in the target ontology then

Individual: @A1
  Facts: hasAge 23

will create an individual ‘Fred’ and will create a data property assertion (‘Fred’ hasAge “23”^^xsd:integer).

Martin
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

MihalyF
Thanks Martin,
how about the opposite case when Fred is already exits in the target
ontology?
The following rule results in an error "Entity already exits ...."
Individual: @A1
  Facts: hasAge 23

Probably I need to express that @A1 should not be generated, just assert the
Property for an existing individual? Something like

Facts: @A1 hasAge 23

Mihaly



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

Ghislain ATEMEZING
Hi Mihaly,
What about just keeping in your Excel file only the facts that should be generated by your rules? 
Or if you already have few facts, and need to update your ontology with many facts, you can delete them (via SPARQL queries?!) before regenerating new facts from Cellfie?

HTH.
Best,
Ghislain

Le ven. 7 déc. 2018 à 12:07, MihalyF <[hidden email]> a écrit :
Thanks Martin,
how about the opposite case when Fred is already exits in the target
ontology?
The following rule results in an error "Entity already exits ...."
Individual: @A1
  Facts: hasAge 23

Probably I need to express that @A1 should not be generated, just assert the
Property for an existing individual? Something like

Facts: @A1 hasAge 23

Mihaly



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


--

"Love all, trust a few, do wrong to none" (W. Shakespeare)

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: Cellfie-plugin: How to refer to a Property

Martin O'Connor-2
In reply to this post by MihalyF
Strange. If the entity exists it should be silently resolved.

For example, if A1=‘Fred’ and an individual called Fred exists in the target ontology then then the following rule should have no effect:

Individual: @A1

By the same token, the rule

Individual: @A1
  Facts: hasAge 23

Should create a property assertion using that existing individual.

You should not be getting an “Entity already exists” error in that situation.

Are you using the latest version of Cellfie in Protege 5.2 (or 5.5. beta)?

Martin

> how about the opposite case when Fred is already exits in the target
> ontology?
> The following rule results in an error "Entity already exits ...."
> Individual: @A1
>  Facts: hasAge 23
>
> Probably I need to express that @A1 should not be generated, just assert the
> Property for an existing individual? Something like
>
> Facts: @A1 hasAge 23
>
> Mihaly
>
>
>
> --
> Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user