protegeproject / swrlapi

Java API for working with the SWRL rule and SQWRL query languages
Other
99 stars 40 forks source link

Using full IRI instead of prefix #45

Open canarvaeza opened 6 years ago

canarvaeza commented 6 years ago

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 😃

martinjoconnor commented 6 years ago

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

canarvaeza commented 6 years ago

possible to modify the api to allow that?

2018-04-25 23:12 GMT+02:00 martinjoconnor notifications@github.com:

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

martinjoconnor commented 6 years ago

It would be quite a bit of work, unfortunately.

canarvaeza commented 6 years ago

Ok thanks :D

2018-04-30 13:06 GMT-05:00 martinjoconnor notifications@github.com:

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

martinjoconnor commented 6 years ago

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.

canarvaeza commented 6 years ago

Hi Marting,

Thanks, this is very useful I will try

2018-05-07 18:18 GMT-05:00 martinjoconnor notifications@github.com:

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