Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added categorisation of terms listed on extension home page. #1098

Merged
merged 1 commit into from Apr 12, 2016
Merged
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

38 api.py
@@ -165,6 +165,8 @@ def __init__ (self, id):
self.home = None
self.subtypes = None
self.sourced = False
self.category = " "
self.typeFlags = {}

def __str__(self):
return self.id
@@ -227,24 +229,43 @@ def directInstanceOf(self, type, layers='core'):

def isClass(self, layers='core'):
"""Does this unit represent a class/type?"""
return self.typeOf(Unit.GetUnit("rdfs:Class"), layers=layers)
if self.typeFlags.has_key('c'):
return self.typeFlags['c']
isClass = self.typeOf(Unit.GetUnit("rdfs:Class"), layers=layers)
if isClass:
self.typeFlags['c'] = isClass
return isClass

def isAttribute(self, layers='core'):
"""Does this unit represent an attribute/property?"""
return self.typeOf(Unit.GetUnit("rdf:Property"), layers=layers)
if self.typeFlags.has_key('p'):
return self.typeFlags['p']
isProp = self.typeOf(Unit.GetUnit("rdf:Property"), layers=layers)
if isProp:
self.typeFlags['p'] = isProp
return isProp

def isEnumeration(self, layers='core'):
"""Does this unit represent an enumerated type?"""
return self.subClassOf(Unit.GetUnit("Enumeration"), layers=layers)
if self.typeFlags.has_key('e'):
return self.typeFlags['e']
isE = self.subClassOf(Unit.GetUnit("Enumeration"), layers=EVERYLAYER)
if isE:
self.typeFlags['e'] = isE
return isE

def isEnumerationValue(self, layers='core'):
"""Does this unit represent a member of an enumerated type?"""
if self.typeFlags.has_key('ev'):
return self.typeFlags['ev']
types = GetTargets(Unit.GetUnit("rdf:type"), self , layers=layers)
log.debug("isEnumerationValue() called on %s, found %s types. layers: %s" % (self.id, str( len( types ) ), layers ) )
found_enum = False
for t in types:
if t.subClassOf(Unit.GetUnit("Enumeration"), layers=layers):
if t.subClassOf(Unit.GetUnit("Enumeration"), layers=EVERYLAYER):
found_enum = True
if found_enum:
self.typeFlags['ev'] = found_enum
return found_enum

def isDataType(self, layers='core'):
@@ -305,6 +326,9 @@ def supersededBy(self, layers='core'):

return ret

def category(self):
return self.category

def getHomeLayer(self,defaultToCore=False):
ret = self.home
if ret == None:
@@ -597,6 +621,12 @@ def GetAllProperties(layers='core'):
DataCache.put(KEY,sorted_all_properties,Utc)
return sorted_all_properties

def GetAllTerms(layers='core'):
ret = GetAllTypes(layers)
ret.extend(GetAllEnumerationValues(layers))
ret.extend(GetAllProperties(layers))
return sorted(ret,key=lambda u: u.id)

def GetParentList(start_unit, end_unit=None, path=[], layers='core'):

"""
@@ -132,6 +132,8 @@ def rdfGetTriples(id):
log.info("WARNING Cannot set %s home to %s - already set to: %s" % (s,layer,unit.home))
unit.home = layer
homeSetTo = layer
elif(p == "category"):
unit.category = row.o

prop = api.Unit.GetUnit(p,True)

@@ -29,6 +29,7 @@

<div typeof="rdfs:Class" resource="http://schema.org/ComicSeries">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span property="schema:category">Comics</span>
<span class="h" property="rdfs:label">bib:ComicSeries</span>
<span property="rdfs:comment">A sequential publication of comic stories under a
unifying title, for example "The Amazing Spider-Man" or "Groo the
@@ -38,6 +39,7 @@

<div typeof="rdfs:Class" resource="http://schema.org/ComicIssue">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span property="schema:category">Comics</span>
<span class="h" property="rdfs:label">bib:ComicIssue</span>
<span property="rdfs:comment">Individual comic issues are serially published as
part of a larger series. For the sake of consistency, even one-shot issues
@@ -50,6 +52,7 @@

<div typeof="rdfs:Class" resource="http://schema.org/ComicStory">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span property="schema:category">Comics</span>
<span class="h" property="rdfs:label">bib:ComicStory</span>
<span property="rdfs:comment">The term "story" is any indivisible, re-printable
unit of a comic, including the interior stories, covers, and backmatter. Most
@@ -59,13 +62,15 @@

<div typeof="rdfs:Class" resource="http://schema.org/CoverArt">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span>Category: <span property="schema:category">Comics</span></span>
<span class="h" property="rdfs:label">bib:CoverArt</span>
<span property="rdfs:comment">The artwork on the outer surface of a CreativeWork.</span>
<span>Subclass of: <a property="rdfs:subClassOf" href="http://schema.org/VisualArtwork">schema:VisualArtwork</a></span>
</div>

<div typeof="rdfs:Class" resource="http://schema.org/ComicCoverArt">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span>Category: <span property="schema:category">Comics</span></span>
<span class="h" property="rdfs:label">bib:ComicCoverArt</span>
<span property="rdfs:comment">The artwork on the cover of a comic.</span>
<span>Subclass of: <a property="rdfs:subClassOf" href="http://schema.org/CoverArt">bib:CoverArt</a></span>
@@ -75,6 +80,8 @@

<div typeof="http://schema.org/BookFormatType" resource="http://schema.org/GraphicNovel">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span>Category: <span property="schema:category">Comics</span></span>
<span property="schema:category">Comics</span>
<span class="h" property="rdfs:label">GraphicNovel</span>
<span property="rdfs:comment">Book format: GraphicNovel. May represent a bound collection of ComicIssue instances.</span>
</div>
@@ -83,6 +90,7 @@

<div typeof="rdf:Property" resource="http://schema.org/publisherImprint">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span>Category: <span property="schema:category">Comics</span></span>
<span class="h" property="rdfs:label">bib:publisherImprint</span>
<span class="h" property="rdfs:comment">The publishing division which published the comic.</span>
<span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/CreativeWork">schema:CreativeWork</a></span>
@@ -91,6 +99,7 @@

<div typeof="rdf:Property" resource="http://schema.org/artist">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span>Category: <span property="schema:category">Comics</span></span>
<span class="h" property="rdfs:label">bib:artist</span>
<span class="h" property="rdfs:comment">The primary artist for a work
in a medium other than pencils or digital line art--for example, if the
@@ -103,6 +112,7 @@

<div typeof="rdf:Property" resource="http://schema.org/colorist">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span>Category: <span property="schema:category">Comics</span></span>
<span class="h" property="rdfs:label">bib:colorist</span>
<span class="h" property="rdfs:comment">The individual who adds color to inked drawings.</span>
<span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/ComicIssue">bib:ComicIssue</a></span>
@@ -113,6 +123,7 @@

<div typeof="rdf:Property" resource="http://schema.org/inker">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span>Category: <span property="schema:category">Comics</span></span>
<span class="h" property="rdfs:label">bib:inker</span>
<span class="h" property="rdfs:comment">The individual who traces over the pencil drawings in ink after pencils are complete.</span>
<span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/ComicIssue">bib:ComicIssue</a></span>
@@ -123,6 +134,7 @@

<div typeof="rdf:Property" resource="http://schema.org/letterer">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span>Category: <span property="schema:category">Comics</span></span>
<span class="h" property="rdfs:label">bib:letterer</span>
<span class="h" property="rdfs:comment">The individual who adds lettering, including speech balloons and sound effects, to artwork.</span>
<span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/ComicIssue">bib:ComicIssue</a></span>
@@ -133,6 +145,7 @@

<div typeof="rdf:Property" resource="http://schema.org/penciler">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span>Category: <span property="schema:category">Comics</span></span>
<span class="h" property="rdfs:label">bib:penciler</span>
<span class="h" property="rdfs:comment">The individual who draws the primary narrative artwork.</span>
<span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/ComicIssue">bib:ComicIssue</a></span>
@@ -143,6 +156,7 @@

<div typeof="rdf:Property" resource="http://schema.org/variantCover">
<link property="http://schema.org/isPartOf" href="http://bib.schema.org" />
<span>Category: <span property="schema:category">Comics</span></span>
<span class="h" property="rdfs:label">bib:variantCover</span>
<span class="h" property="rdfs:comment">A description of the variant cover
for the issue, if the issue is a variant printing. For example, "Bryan Hitch
@@ -67,6 +67,14 @@
"schema:domainIncludes": "http://schema.org/Property",
"schema:isPartOf": "http://meta.schema.org",
"schema:rangeIncludes":"http://schema.org/Class"
},
{
"@id": "http://schema.org/category",
"@type": "rdf:Property",
"schema:domainIncludes": [
"http://schema.org/Property",
"http://schema.org/Class"
]
}
]
}
@@ -3,6 +3,7 @@

<div typeof="rdf:Property" resource="http://schema.org/contentReferenceTime">
<link property="http://schema.org/isPartOf" href="http://pending.schema.org" />
<span>Category: <span property="schema:category">issue-1050</span></span>
<span class="h" property="rdfs:label">contentReferenceTime</span>
<span property="rdfs:comment">The specific time described by a creative work, for works (e.g. articles, video objects etc.) that emphasise a particular moment within an Event.</span>
<span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/CreativeWork">CreativeWork</a></span>
@@ -3,13 +3,15 @@

<div typeof="rdfs:Class" resource="http://schema.org/ClaimReview">
<link property="http://schema.org/isPartOf" href="http://pending.schema.org" />
<span>Category: <span property="schema:category">issue-1061</span></span>
<span class="h" property="rdfs:label">ClaimReview</span>
<span property="rdfs:comment">A fact-checking review of claims made (or reported) in some creative work (referenced via itemReviewed).</span>
<span>Subclass of: <a property="rdfs:subClassOf" href="http://schema.org/Review">Review</a></span>
</div>

<div typeof="rdf:Property" resource="http://schema.org/claimReviewed">
<link property="http://schema.org/isPartOf" href="http://pending.schema.org" />
<span>Category: <span property="schema:category">issue-1061</span></span>
<span class="h" property="rdfs:label">claimReviewed</span>
<span property="rdfs:comment">A short summary of the specific claims reviewed in a ClaimReview.</span>
<span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/CreativeWork">CreativeWork</a></span>
@@ -19,6 +21,7 @@

<div typeof="rdf:Property" resource="http://schema.org/claimReviewSiteLogo">
<link property="http://schema.org/isPartOf" href="http://pending.schema.org" />
<span>Category: <span property="schema:category">issue-1061</span></span>
<span class="h" property="rdfs:label">claimReviewSiteLogo</span>
<span property="rdfs:comment">The URL of the logo of the main author of a ClaimReview.</span>
<span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/ClaimReview">ClaimReview</a></span>
ProTip! Use n and p to navigate between commits in a pull request.