Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7577957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:18:59+00:00 2026-05-30T17:18:59+00:00

I have a Python list of tuple. Each tuple contains the attributes of a

  • 0

I have a Python list of tuple. Each tuple contains the attributes of a place. For example, within each tuple is a place category, place name, place lat, place long, and place description. I want write a script that annotates each of these place attributes in rdf. When I attempt to verify the output from the code below using the validator at http://www.w3.org/RDF/Validator/, only the lat and long show up as properly annotated rdf. How can I alter the code to properly annotate it? Note that place[0] is the place category (I didn’t include this below), place[1] is the place name (e.g., Sears Tower), place[2] is the place lat, place[3] is the place long, and place[5] is the place description. Thanks.

        rdf_conversion.append("""

        <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="http://xmlns.com/foaf/0.1/"
            xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">

            <rdfs:label>"""+place[1]+"""</rdfs:label>
            <geo:Point>
                <geo:lat>"""+str(place[2])+"""</geo:lat>
                <geo:long>"""+str(place[3])+"""</geo:long>
            </geo:Point>
            <rdfs:comment>"""+place[5]+"""</rdfs:comment>

        </rdf:RDF>

        """)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:19:00+00:00Added an answer on May 30, 2026 at 5:19 pm

    You have to add something surrounding to enclose your description, e.g. schema.org‘s Place type so that your example would look like the following snippet:

            <schemaorg:Place rdf:about="place[0]">
               <rdfs:label>"+place[1]+"</rdfs:label>
               <geo:location>    
                   <geo:Point>
                      <geo:lat>"""+str(place[2])+"""</geo:lat>
                      <geo:long>"""+str(place[3])+"""</geo:long>
                   </geo:Point>
               </geo:location>
               <rdfs:comment>"""+place[5]+"""</rdfs:comment>
            </schemaorg:Place>
    

    btw, you could also utilise the better human-readable Turtle syntax. Then your example would like the following snippet:

    @prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix schema: <http://schema.org/> .
    
    <place[0]> a schema:Place;
      rdfs:label "+place[1]+";
      rdfs:comment "+place[5]+";
      geo:location [ 
         a geo:Point;
         geo:lat "+str(place[2])+";
         geo:long "+str(place[3])+"
      ] .
    

    PS: keep always in mind the subject-predicate-object order of an RDF triple 😉
    PPS: and make use of the recommended RDF libs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have list in python which has following entries name-1 name-2 name-3 name-4 name-1
I'm using Python 2.6, and I have two datasets, each being a list of
I have the following Python list (can also be a tuple): myList = ['foo',
I have a list of tuples where each tuple is a (start-time, end-time) .
i have an issue i could use some help with, i have python list
I have a Python list, say l = [1,5,8] I want to write a
I have a Python list that I'm supplying to the template: {'error_name':'Please enter a
I have a python list as [ (A,{'a':1,'b':2,'c':3,'d':4}), B,{'a':1,'b':2,'c':3,'d':4}), ... ] I want to
Python list comprehensions are nice, but near impossible to debug. You guys have any
I have a list of Python objects that I want to sort by a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.