swrlapi icon indicating copy to clipboard operation
swrlapi copied to clipboard

Using full IRI instead of prefix

Open canarvaeza opened this issue 6 years ago • 6 comments

Hi,

I'm working with a rdf stream which is generated from a JSON file, the tool I use give me a turtle file without prefixes. It seems that SWRL only work with prefixes, I try to write http://xmlns.com/foaf/0.1/Person instead of foaf:Person In the SWRL tab and it does't work, says that html is not a prefix.

Can I use this in any way? or I have to create the prefixes (not god because we don't know the procedence of the data all times).

Here is the result file. salida.ttl.txt

Thanks 😃

canarvaeza avatar Apr 25 '18 09:04 canarvaeza

Unfortunately, only prefixed names are supported by the SWRLAPI parser.

martinjoconnor avatar Apr 25 '18 21:04 martinjoconnor

possible to modify the api to allow that?

2018-04-25 23:12 GMT+02:00 martinjoconnor [email protected]:

Unfortunately, only prefixed names are supported by the SWRLAPI parser.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/protegeproject/swrlapi/issues/45#issuecomment-384435757, or mute the thread https://github.com/notifications/unsubscribe-auth/AT0gtcaCQRDz4b0xO0Wv8Gse2clzuMRPks5tsObAgaJpZM4TjHGC .

--

Cristian Andres Narvaez Alarcon Estudiante de Maestría en Ingeniería de Sistemas y Computación Universidad Nacional de Colombia

canarvaeza avatar Apr 26 '18 08:04 canarvaeza

It would be quite a bit of work, unfortunately.

martinjoconnor avatar Apr 30 '18 18:04 martinjoconnor

Ok thanks :D

2018-04-30 13:06 GMT-05:00 martinjoconnor [email protected]:

It would be quite a bit of work, unfortunately.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/protegeproject/swrlapi/issues/45#issuecomment-385480937, or mute the thread https://github.com/notifications/unsubscribe-auth/AT0gtT5h9vDdhU1yr0i84aPAF-fa0Fxwks5tt1K2gaJpZM4TjHGC .

--

Cristian Andres Narvaez Alarcon Estudiante de Maestría en Ingeniería de Sistemas y Computación Universidad Nacional de Colombia

canarvaeza avatar May 04 '18 17:05 canarvaeza

Note that you may be able to handle this in your code depending in how you are doing the rule generation.

You can generate a unique prefix (e.g., autogen0) for each namespace without a prefix in the ontology and set this prefix using the OWLAPI so that the SWRL parser will recognize the prefix.

For example, if you encounter a URI http:/example.com/Classes/Dog where http:/example.com/Classes/ has no prefix definition you can do the following:

manager.getOntologyFormat(ontology).asPrefixOWLOntologyFormat().setDefaultPrefix("autogen" + i++, "http:/example.com/Classes/");

Then substitute the namespace + localname for the prefixed form in the rule (e.g., autogen0:Dog) and the parsing will work.

You will effectively be building a temporary prefix map.

martinjoconnor avatar May 07 '18 23:05 martinjoconnor

Hi Marting,

Thanks, this is very useful I will try

2018-05-07 18:18 GMT-05:00 martinjoconnor [email protected]:

Note that you may be able to handle this in your code depending in how you are doing the rule generation.

You can generate a unique prefix (e.g.,autogen0) for each namespace without a prefix in the ontology and set this prefix using the OWLAPI so that the SWRL parser will recognize the prefix.

For example, if you encounter a URI http:/example.com/Classes/Dog where http:/example.com/Classes/ has no prefix definition you can do the following:

manager.getOntologyFormat(ontology).asPrefixOWLOntologyFormat().setDefaultPrefix("autogen" + i++, "http:/example.com/Classes/");

Then substitute the namespace + localname for the prefixed form in the rule (e.g., autogen0:Dog) and the parsing will work.

You will effectively be building a temporary prefix map.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/protegeproject/swrlapi/issues/45#issuecomment-387235414, or mute the thread https://github.com/notifications/unsubscribe-auth/AT0gte-eFr1aa_hLrDp-pgB2LbSiOwVhks5twNZFgaJpZM4TjHGC .

--

Cristian Andres Narvaez Alarcon Estudiante de Maestría en Ingeniería de Sistemas y Computación Universidad Nacional de Colombia

canarvaeza avatar May 08 '18 15:05 canarvaeza