From 9f5103fac240d8d8a5c72adcde1a339306a6d100 Mon Sep 17 00:00:00 2001 From: brianjlowe Date: Thu, 31 Oct 2013 16:55:32 -0400 Subject: [PATCH 1/4] property domains and restrictions for reproducedIn and numPages, VIVO-389 and VIVO-421 --- rdf/tbox/filegraph/classes-additional.owl | 12 ++++++------ rdf/tbox/filegraph/object-properties3.owl | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/rdf/tbox/filegraph/classes-additional.owl b/rdf/tbox/filegraph/classes-additional.owl index 70b15bee..4e57d6f7 100644 --- a/rdf/tbox/filegraph/classes-additional.owl +++ b/rdf/tbox/filegraph/classes-additional.owl @@ -194,12 +194,6 @@ - - - - - - @@ -313,6 +307,12 @@ + + + + + + diff --git a/rdf/tbox/filegraph/object-properties3.owl b/rdf/tbox/filegraph/object-properties3.owl index c763feae..9016bea2 100644 --- a/rdf/tbox/filegraph/object-properties3.owl +++ b/rdf/tbox/filegraph/object-properties3.owl @@ -213,7 +213,8 @@ - + + From a7e53d9ac0e4e370631e2dbe31e062d70c805781 Mon Sep 17 00:00:00 2001 From: j2blake Date: Thu, 31 Oct 2013 17:11:11 -0400 Subject: [PATCH 2/4] Polish the obsolete_URI script, so it can be used to scan an active workspace, not just a released directory. --- utilities/ISF-transition/obsoleteUris/doit2 | 7 +++ .../ISF-transition/obsoleteUris/event.rb | 14 +++++- .../obsoleteUris/known_exceptions.rb | 28 +++++++++-- .../obsoleteUris/obsoleteUriChecker.rb | 2 +- .../ISF-transition/obsoleteUris/report.rb | 17 +++---- .../obsoleteUris/vivo_known_exceptions_2.txt | 46 +++++++++++++++++++ 6 files changed, 96 insertions(+), 18 deletions(-) create mode 100755 utilities/ISF-transition/obsoleteUris/doit2 create mode 100644 utilities/ISF-transition/obsoleteUris/vivo_known_exceptions_2.txt diff --git a/utilities/ISF-transition/obsoleteUris/doit2 b/utilities/ISF-transition/obsoleteUris/doit2 new file mode 100755 index 00000000..2f8a8b33 --- /dev/null +++ b/utilities/ISF-transition/obsoleteUris/doit2 @@ -0,0 +1,7 @@ +ruby obsoleteUriChecker.rb /Users/jeb228/git/VIVO \ + ../../../productMods/WEB-INF/ontologies/update/diff.tab.txt \ + vivo_known_exceptions_2.txt complete > scan_VIVO_maint_branch +ruby obsoleteUriChecker.rb /Users/jeb228/git/Vitro \ + ../../../productMods/WEB-INF/ontologies/update/diff.tab.txt \ + vivo_known_exceptions_2.txt complete > scan_Vitro_maint_branch + diff --git a/utilities/ISF-transition/obsoleteUris/event.rb b/utilities/ISF-transition/obsoleteUris/event.rb index 00f1a598..b35de06c 100644 --- a/utilities/ISF-transition/obsoleteUris/event.rb +++ b/utilities/ISF-transition/obsoleteUris/event.rb @@ -5,9 +5,15 @@ class Event attr_reader :string attr_reader :is_localname + require 'pathname' + # ------------------------------------------------------------------------------------ private # ------------------------------------------------------------------------------------ + + def relativize(root, path) + Pathname.new(path).relative_path_from(Pathname.new(root)).to_s + end # ------------------------------------------------------------------------------------ public @@ -21,7 +27,11 @@ class Event @is_localname = string[0] == ?: end - def to_s() - "#{@path} \n #{@line_number} #{@line} \n #{@string} #{@is_localname ? "Localname" : "URI"}" + def to_s(directory_root = nil) + if directory_root + "#{relativize(directory_root, @path)} \n #{@line_number} #{@line} \n #{@string} #{@is_localname ? "Localname" : "URI"}" + else + "#{@path} \n #{@line_number} #{@line} \n #{@string} #{@is_localname ? "Localname" : "URI"}" + end end end diff --git a/utilities/ISF-transition/obsoleteUris/known_exceptions.rb b/utilities/ISF-transition/obsoleteUris/known_exceptions.rb index 871782ee..745b0a1e 100644 --- a/utilities/ISF-transition/obsoleteUris/known_exceptions.rb +++ b/utilities/ISF-transition/obsoleteUris/known_exceptions.rb @@ -1,5 +1,22 @@ +require 'pathname' + class KnownExceptionsError < StandardError; end +class GlobSkipper + def initialize(root_path, glob) + @root_path = root_path + @glob = glob + end + + def relativize(path) + Pathname.new(path).relative_path_from(Pathname.new(@root_path)).to_s + end + + def skip?(path, line, uri) + return File.fnmatch(@glob, relativize(path)) + end +end + class ExtensionSkipper def initialize(extension) @extension = extension @@ -44,10 +61,11 @@ class KnownExceptions line.strip! next if line.length == 0 || line[0..0] == '#' || line[0] == ?! - if line =~ /^\.[^\/]*$/ - skippers << ExtensionSkipper.new(line) - elsif line =~ /^(\S+)\s*$/ - skippers << PathSkipper.new(@root_path, $1) +# if line =~ /^\.[^\/]*$/ +# skippers << ExtensionSkipper.new(line) + if line =~ /^(\S+)\s*$/ +# skippers << PathSkipper.new(@root_path, $1) + skippers << GlobSkipper.new(@root_path, $1) elsif line =~ /^(\S+)\s*(\d+)\s*$/ skippers << LineSkipper.new(@root_path, $1, $2.to_i) else @@ -71,7 +89,7 @@ class KnownExceptions if line_number == -1 next if skipper.is_a?(LineSkipper) else - next if skipper.is_a?(ExtensionSkipper) || skipper.is_a?(PathSkipper) + next if skipper.is_a?(ExtensionSkipper) || skipper.is_a?(PathSkipper) || skipper.is_a?(GlobSkipper) end if skipper.skip?(file, line_number, string) diff --git a/utilities/ISF-transition/obsoleteUris/obsoleteUriChecker.rb b/utilities/ISF-transition/obsoleteUris/obsoleteUriChecker.rb index 27463d8b..70a87211 100644 --- a/utilities/ISF-transition/obsoleteUris/obsoleteUriChecker.rb +++ b/utilities/ISF-transition/obsoleteUris/obsoleteUriChecker.rb @@ -80,8 +80,8 @@ class ObsoleteUriChecker # ------------------------------------------------------------------------------------ def initialize(args) - @report = Report.new(args) @directory_root, @obsolete_uris, @known_exceptions, @complete = parse_arguments(args) + @report = Report.new(args, @directory_root) rescue UsageError => e puts "\n----------------\nUsage error\n----------------\n\n#{e}\n\n----------------\n\n" exit diff --git a/utilities/ISF-transition/obsoleteUris/report.rb b/utilities/ISF-transition/obsoleteUris/report.rb index 0bdef5eb..a964422e 100644 --- a/utilities/ISF-transition/obsoleteUris/report.rb +++ b/utilities/ISF-transition/obsoleteUris/report.rb @@ -3,6 +3,10 @@ class Report private # ------------------------------------------------------------------------------------ + def relativize(path) + Pathname.new(path).relative_path_from(Pathname.new(@directory_root)).to_s + end + def state_arguments() puts puts "-----------------------------------------------------------------" @@ -29,9 +33,8 @@ class Report hash[event.path] = hash[event.path] << event end -# puts "FLAT: #{hash.to_a.flatten}" hash.sort.each do |path, events| - puts "#{path}" + puts "#{relativize(path)}" events.sort{|a, b| a.line_number <=> b.line_number }.each do |e| trimmed = if e.line.size <= 100 @@ -46,18 +49,13 @@ class Report end end - def list_events() - @events.each do |event| - puts "Event: #{event}" - end - end - # ------------------------------------------------------------------------------------ public # ------------------------------------------------------------------------------------ - def initialize(args) + def initialize(args, directory_root) @args = args; + @directory_root = directory_root @file_count = 0 @extensions_count = Hash.new(0) @events = [] @@ -75,7 +73,6 @@ class Report def report() state_arguments() file_summary() -# list_events() collate_and_list_events() end end diff --git a/utilities/ISF-transition/obsoleteUris/vivo_known_exceptions_2.txt b/utilities/ISF-transition/obsoleteUris/vivo_known_exceptions_2.txt new file mode 100644 index 00000000..8d1d4e7e --- /dev/null +++ b/utilities/ISF-transition/obsoleteUris/vivo_known_exceptions_2.txt @@ -0,0 +1,46 @@ +.* +bin + +*.GIF +*.as +*.class +*.fla +*.gif +*.gz +*.ico +*.jar +*.jpg +*.psd +*.png +*.swf +*.war +*.zip + +**/.* + +# +# first_pass: no excluded files. everything was duplicated in the .bin directory, and +# probably in the .build directory also. Ran against the repository, so VIVO +# only. +# +# 7498 89730 2277668 first_pass.output +# + +test/edu/cornell/mannlib/vitro/webapp/search/solr/NIHVIVO3853_DataSet1.rdf +productMods/WEB-INF/ontologies/update/oldVersion/vivo-event-1.5.owl +productMods/WEB-INF/ontologies/update/oldAnnotations/vivo-core-1.5-annotations.rdf +productMods/WEB-INF/ontologies/update/diff.tab.txt + +# +# second_pass: excluded these nasty files. Ran against a clean distro, with VIVO and +# Vitro, but no .bin or .build +# +# 1798 5159 170092 second_pass.output +# + +productMods/WEB-INF/ontologies/update/oldVersion/vivo-foaf-1.5.owl +productMods/WEB-INF/ontologies/update/oldVersion/vivo-core-1.5.owl +productMods/WEB-INF/ontologies/update/oldVersion/vivo-bibo-1.5.owl +productMods/WEB-INF/ontologies/update/oldVersion/scires-1.5.owl +productMods/WEB-INF/ontologies/update/oldVersion/vivo-dcterms-1.5.owl +productMods/WEB-INF/ontologies/update/oldVersion/vivo-dcelements-1.5.owl From 6ebb58c746e5b629329af40e2ee4595dcd86b0b6 Mon Sep 17 00:00:00 2001 From: brianjlowe Date: Fri, 1 Nov 2013 09:26:53 -0400 Subject: [PATCH 3/4] VIVO-390 re-add subjectAreaFor --- rdf/tbox/filegraph/object-properties3.owl | 10 ++++++++++ rdf/tbox/firsttime/initialTBoxAnnotations.n3 | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/rdf/tbox/filegraph/object-properties3.owl b/rdf/tbox/filegraph/object-properties3.owl index 9016bea2..f4ea1be4 100644 --- a/rdf/tbox/filegraph/object-properties3.owl +++ b/rdf/tbox/filegraph/object-properties3.owl @@ -448,9 +448,19 @@ + + + + + + + + + + diff --git a/rdf/tbox/firsttime/initialTBoxAnnotations.n3 b/rdf/tbox/firsttime/initialTBoxAnnotations.n3 index 36af8a0a..98a5b7cc 100644 --- a/rdf/tbox/firsttime/initialTBoxAnnotations.n3 +++ b/rdf/tbox/firsttime/initialTBoxAnnotations.n3 @@ -581,6 +581,23 @@ vivo:researchAreaOf vitro:selectFromExistingAnnot "true"^^xsd:boolean . +vivo:subjectAreaOf + rdfs:label "subject area of"@en-US ; + vitro:displayLimitAnnot + "5"^^xsd:int ; + vitro:displayRankAnnot + "10"^^xsd:int ; + vitro:hiddenFromDisplayBelowRoleLevelAnnot + ; + vitro:inPropertyGroupAnnot + ; + vitro:offerCreateNewOptionAnnot + "true"^^xsd:boolean ; + vitro:prohibitedFromUpdateBelowRoleLevelAnnot + ; + vitro:selectFromExistingAnnot + "true"^^xsd:boolean . + geo:populationTotal rdfs:label "total population"@en-US ; vitro:hiddenFromDisplayBelowRoleLevelAnnot From d666a076bfc93fe82dd7bd7125651ac44ac6fb0f Mon Sep 17 00:00:00 2001 From: brianjlowe Date: Fri, 1 Nov 2013 09:32:40 -0400 Subject: [PATCH 4/4] VIVO-392 use vcard:Kind for non-agents --- .../update/sparqlConstructs/additions/vcard1-3.sparql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/productMods/WEB-INF/ontologies/update/sparqlConstructs/additions/vcard1-3.sparql b/productMods/WEB-INF/ontologies/update/sparqlConstructs/additions/vcard1-3.sparql index 96076c4f..fb409425 100644 --- a/productMods/WEB-INF/ontologies/update/sparqlConstructs/additions/vcard1-3.sparql +++ b/productMods/WEB-INF/ontologies/update/sparqlConstructs/additions/vcard1-3.sparql @@ -7,7 +7,7 @@ PREFIX owl: CONSTRUCT { ?s arg:ARG_2000028 _:vcard . _:vcard arg:ARG_2000029 ?s . - _:vcard a v:Individual . + _:vcard a v:Kind . } WHERE { ?s vivo:webpage ?webpage FILTER NOT EXISTS { ?s a foaf:Agent }