Unresolved prefixed name: rdfs:subClassOf in SPARQL query

后端 未结 2 1070
天涯浪人
天涯浪人 2020-12-21 03:40
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.lang.*;
import java.util.regex.*;
import java.         


        
相关标签:
2条回答
  • 2020-12-21 04:12

    As William's succinct answer implies the problem is that you haven't defined what the rdfs prefix represents. Prefixed Names in SPARQL and other related RDF standards are purely a syntactic convenience for writing queries and data in a more compact and readable way. You can assign a prefix to represent any namespace URI you want so you must always explicitly define your prefixes using the mechanism of the format you are using.

    In the case of SPARQL this is the PREFIX keyword which is used to define prefixes. These definitions must appear before the main body of your query and you can have as many definitions as you want present.

    0 讨论(0)
  • 2020-12-21 04:20
    String queryString ="SELECT ?ds ?o WHERE {?ds  rdfs:subClassOf ?o }";
    

    Should be

    String queryString ="PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    SELECT ?ds ?o WHERE {?ds  rdfs:subClassOf ?o }";  
    
    0 讨论(0)
提交回复
热议问题