1

I have created a simple ontology using Protege and now I want to retrieve data from the RDF file of that ontology. I have an object property like below:

<JavaOntology:sameQuestionAs rdf:resource="http://www.semanticweb.org/jeny/ontologies/2018/8/JavaOntology#What_is_the_purpose_of_Class_in_java"/>

I want to retrieve only the part after #. For example, I want the output as What_is_the_purpose_of_Class_in_java. But when I receive the RDF file I get the output as this

http://www.semanticweb.org/jeny/ontologies/2018/8/JavaOntology#What_is_the_purpose_of_Class_in_java

How can I do this?

Gilles-Antoine Nys
  • 1,481
  • 16
  • 21
jenyK
  • 71
  • 6
  • Actually, the "correct" way would be to add additional data providing the human-readable form of the RDF/OWL entities. This is best practice. For example, mostly `rdfs:label` is used for this. In Protege this is done via the annotations. – UninformedUser Jan 29 '19 at 06:51
  • can you please provide an example query for that. – jenyK Jan 29 '19 at 06:54
  • If you really want to use SPARQL, you have to use string modifications - which is actually weird, because it shouldn't be necessary in a perfect world - but to some extend possible. `prefix ex: select ?name {?s ?p ?o. bind(strafter(str(?o),str(ex:)) as ?name)}` is the common way to do it. Indeed, you have to adapt it to your query which you didn't show here, so I can only show it for a generic query. – UninformedUser Jan 29 '19 at 06:55
  • By the way, you question title is totally misleading...I don't what this has to do with *"retrieve object properties from RDF ... "* – UninformedUser Jan 29 '19 at 06:59
  • thanks @AKSW it worked and sorry if it is misleading. I am a beginner in this area – jenyK Jan 29 '19 at 07:03
  • 1
    Ok, then please provide the working query as an answer here and click on accept such others can see this question was solved. Thanks – UninformedUser Jan 29 '19 at 07:18

0 Answers0