如何在RDF中定义自己的标记和现有类之间的关系

时间:2016-08-12 12:00:02

标签: xml rdf w3c-validation rdf-xml

我想解释一下,public class MainActivity extends Activity { private File root; private ArrayList<File> fileList = new ArrayList<File>(); private LinearLayout view; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); view = (LinearLayout) findViewById(R.id.view); //getting SDcard root path root = new File(Environment.getExternalStorageDirectory() .getAbsolutePath()); getfile(root); for (int i = 0; i < fileList.size(); i++) { TextView textView = new TextView(this); textView.setText(fileList.get(i).getName()); textView.setPadding(5, 5, 5, 5); System.out.println(fileList.get(i).getName()); if (fileList.get(i).isDirectory()) { textView.setTextColor(Color.parseColor("#FF0000")); } view.addView(textView); } } public ArrayList<File> getfile(File dir) { File listFile[] = dir.listFiles(); if (listFile != null && listFile.length > 0) { for (int i = 0; i < listFile.length; i++) { if (listFile[i].isDirectory()) { fileList.add(listFile[i]); getfile(listFile[i]); } else { if (listFile[i].getName().endsWith(".png") || listFile[i].getName().endsWith(".jpg") || listFile[i].getName().endsWith(".jpeg") || listFile[i].getName().endsWith(".gif")) { fileList.add(listFile[i]); } } } } return fileList; } } 是我自己的标记,它与RDF中LRMI元数据术语中的现有类educationalRole相关。

我编写了以下RDF / XML表示法:

EducationalAudience

W3C validator返回:

  

错误:{E201} rdf:资源不允许作为此属性。

我很了解这一点。任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

你试过这个吗?

<?xml version="1.0" encoding="UTF-8"?>
    <rdf:RDF
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:exs="http://example.org/schema#"
        xmlns:exr="http://example.org#">  

        <rdf:Description rdf:about="http://www.youtube.com/v/CH6FQhlZn6k">  
            <dc:title>Napoleon forced to abdicate</dc:title>
            <exs:educationalRole>student</exs:educationalRole>
        </rdf:Description>
        <rdf:Description rdf:about="exs:educationalRole">
                <rdfs:subClassOf rdf:resource="http://schema.org/EducationalAudience"/>
        </rdf:Description>
    </rdf:RDF>