开发者

Using rowlex library to extract tagget information in C#

开发者 https://www.devze.com 2023-03-08 23:35 出处:网络
I am using Rowlex Library. I have a .rdf.xml (extension) file wi开发者_StackOverflowth content: <Ontologyowl:User rdf:about=\"userid_1\">

I am using Rowlex Library. I have a .rdf.xml (extension) file wi开发者_StackOverflowth content:

<Ontologyowl:User rdf:about="userid_1">
    <Ontologyowl:hasRated>
          <Ontologyowl:Rating rdf:about="Rating_1">
         </Ontologyowl:Rating>
    </Ontologyowl:hasRated>
    <Ontologyowl:hasRated>
          <Ontologyowl:Rating rdf:about="Rating_1">
         </Ontologyowl:Rating>
    </Ontologyowl:hasRated>
</Ontologyowl:User>

I intend to extract the information in the "hasRated" tag. I know it could be achieved using the "Rating" URI, but the output i get is not what i require. I intend to extract all information in the "hasRated" tag (as mentioned in the hasRated tag) in the file. Currently i am able to extract information from the first "hasRated" tag only, I need to extract information from every "hasRated" tag of user.

I would really appreciate any help provided in this matter. Thanks.


If I understand your question correctly, you generated an assembly with OwlGrinder.exe from your ontology. In the class User, the User.hasRated property allows you to access only the first content. But you would like to have something like this:

public class User : OwlThing
{
    ...
    public Rating hasRated { get... set...}
    public Rating[] hasRateds {get... set...}
    ...
}

I have good news, you can have it. You have two choices:

  • Using full classes. Besides many more rarely used features, full classes have array version of all properties, too. They are recognizable from their naming convention, their names always end with underscore. When you look for the User individuals in the RdfDocument, get full classes (User_ instead of User). More about the light and full classes you can read on the second half of this page: http://rowlex.nc3a.nato.int/Content/AssemblyGeneration.htm

  • Download ROWLEX2.3 (published just before writing this answer). The autogenerated light classes now also feature array version of the properties.

0

精彩评论

暂无评论...
验证码 换一张
取 消